Closed GoogleCodeExporter closed 9 years ago
Iterators.elementsEqual will behave *very* differently than you expect if you
pass in the same iterator, since both of them will be calling next() on the
same iterator.
(Indeed, we should reject == arguments out of hand, no?)
Original comment by lowas...@google.com
on 1 Nov 2012 at 3:13
Well, unless you want to allow one to verify that a single iterator contains
successive pairs of equal elements... Nah let's not. ;)
Original comment by stephan...@gmail.com
on 1 Nov 2012 at 4:07
Submitted change internally; should be mirrored out soon.
We decided not to change Iterators.elementsEqual, because -- among other things
-- many empty collections return Iterators.emptyIterator(), which is of course
== to itself.
We considered rejecting == nonempty iterators, but decided it probably wasn't
worth the complication, since you'd almost never encounter that case unless you
were doing so deliberately.
Original comment by lowas...@google.com
on 7 Nov 2012 at 8:33
Original comment by lowas...@google.com
on 7 Nov 2012 at 8:33
Maybe it can be a bad idea to check size() of a Collection if this is a
FilteredCollection, returned by Collections2.filter(), what do you think? If
compared collections have same size then such check will result in double
filtering in worst case. Maybe at least document it?
Original comment by Ash2kk@gmail.com
on 13 Nov 2012 at 4:51
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:13
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
Ash2kk@gmail.com
on 1 Nov 2012 at 9:15