java Eclipse Collections是否有用于集合的containsAny()方法?
我似乎在Eclipse集合中找不到containsAny()
类型的SetIterable
方法。有吗
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.
写一篇很容易:
/**
* 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();
}
但我只是想知道是否已经有了
# 1 楼答案
我看不到containsAny方法,但您可以这样做: