I can't seem to find a containsAny() method for SetIterable types in Eclipse Collections. Is there one?
MutableSet<String> set1 = Sets.mutable.of("a", "b", "c");
ImmutableSet<String> set2 = Sets.immutable.of("c", "d", "e");
set1.containsAny(set2); // I can't find this method.
It's easy enough to write one:
/**
* True if [set1] contains any element in [set2].
*/
public static <T> boolean intersects(SetIterable<T> set1, SetIterable<? extends T> set2) {
return set1.intersect(set2).notEmpty();
}
But I just wanted to know if one already existed.
I don't see a containsAny method, but you can do this: