DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Iterators.containsAll() #1468

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Would be nice to have a function Iterators.containsAll(Iterator<T>, Iterable<T>)

Original issue reported on code.google.com by egor@technoparkcorp.com on 3 Jul 2013 at 3:23

GoogleCodeExporter commented 9 years ago
Iterators.all(iterator, Predicates.in(collection)) ?

Original comment by wasserman.louis on 3 Jul 2013 at 3:41

GoogleCodeExporter commented 9 years ago
I think that's a little different Louis, as it would succeed for an iterator 
that contains just one (or even zero) of the elements in the collection.

@egor: I assume you're asking for something that checks that the iterator 
contains every distinct element that the iterable contains? Doesn't look like 
something that could be implemented especially efficiently. You'd probably need 
to copy the iterable to a set and then remove elements from that set as you 
iterate over the iterator or something.

What's your use case?

Original comment by cgdecker@google.com on 3 Jul 2013 at 3:48

GoogleCodeExporter commented 9 years ago
Ahhhh, you're right; I was switching the arguments around.  This is more like 
Collection.containsAll(Iterator)?

Original comment by wasserman.louis on 3 Jul 2013 at 4:42

GoogleCodeExporter commented 9 years ago
Exactly, this is like Collection#containsAll(Iterator)

Original comment by egor@technoparkcorp.com on 3 Jul 2013 at 4:45

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08