Closed GoogleCodeExporter closed 8 years ago
Just wondering: what do you use this predicate for? Do you use it to filter?
You
can use the Itera*s.filter(Itera*, Class) overload for that. But maybe you use
it
for something else.
I can see how you might find it useful, but it may or may not need to be in the
library given the ease of implementing it.
Original comment by kevin...@gmail.com
on 9 Jan 2009 at 4:03
Hello Kevin,
We do use Iterables.filter(iterable, class) as soon as we have to iterate on a
subset
of the original iterable.
But, we have pieces of code based on boolean expressions where other
Iterables.functions are used, such as:
if (Iterables.any(changes, instanceOf(InvalidChange.class))) {
//...
}
static boolean canCommit(final Iterable<Change> changes) {
return Iterables.all(changes, instanceOf(ValidChange.class));
}
Regards,
Regis.
Original comment by rdesgrop...@gmail.com
on 9 Jan 2009 at 5:27
Thanks for the examples!
I'm still on the fence as to whether this needs to be a pre-fab Predicate.
Thinking
aloud, I am concerned that if it is, people will use it to filter(), instead of
using
the right version of filter(), then they'll find their resulting Iterable isn't
of
the "right" type, then they'll start casting and getting warnings, etc.
Original comment by kevin...@gmail.com
on 9 Jan 2009 at 5:58
[deleted comment]
I understand your point of view: you would like that Google Collections' users
use
them the right way. It's all credit to you.
Nevertheless, I think other misuses of Google Collections' functions exist here
and
there... so what?
When you provide an API, you give the corresponding documentation, but
unfortunately
not the corresponding good sense.
So... it's up to you,
Regis.
Original comment by rdesgrop...@gmail.com
on 11 Jan 2009 at 5:57
We got several more requests for this, and we will be adding it soon.
Original comment by kevin...@gmail.com
on 14 Feb 2009 at 3:27
Original comment by kevin...@gmail.com
on 18 Mar 2009 at 2:21
Original comment by kevin...@gmail.com
on 24 Mar 2009 at 10:07
Original issue reported on code.google.com by
rdesgrop...@gmail.com
on 9 Jan 2009 at 9:17