Closed GoogleCodeExporter closed 9 years ago
There was some discussion about this internally, but we decided against adding
this. Here is some of the points we talked about:
- Would we use order-dependent or order-independent equality? The appropriate answer would depend on what type of Collection is being used with filter().
- For some collections, (for instane some Queues) [a,b] is not necessarily "equal" to [a,b].
- Similar JDK and guava wrappers such as synchronizedCollection, checkedCollection, and unmodifiableCollection don't implement equals.
For your specific case, I would recommend
assertTrue(Iterables.elementsEqual(filter(s, alwaysTrue()), s)).
Original comment by boppenh...@google.com
on 30 Dec 2010 at 1:21
[deleted comment]
Thanks for explaining. This is clearly my mistake. I should use Lists.filter
but since there's no such method I (mistakenly) used the one from Collections2.
I think I should use
ImmutableList.copyOf(Iterables.filter(s))
to get List as filtering result.
Original comment by kopperni...@gmail.com
on 30 Dec 2010 at 6:50
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
kopperni...@gmail.com
on 29 Dec 2010 at 3:39