Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.4
-
None
Description
class Foo { private String name Foo(String name) { this.name = name } public boolean equals(Object o) { if (this == o) return true if (o == null || getClass() != o.getClass()) return false Foo that = (Foo) o return Objects.equals(name, that.name) } public int hashCode() { return Objects.hash(name) } } def a = [new Foo("foo")] def b = [new Foo("foo")] assert !a.disjoint(b)
If disjoint() is used on a list with objects not implementing Comparable the wrong result is returned.
intersect() shows the same wrong behavior.
It's looks like the NumberAwareComparator not implementing the equals case as of commit 286532c is the problem.
Attachments
Issue Links
- relates to
-
GROOVY-7602 Intersect returns an empty list when the contents of the compared Collections are Maps
- Closed