【发布时间】:2021-06-09 22:23:21
【问题描述】:
我似乎在 Eclipse Collections 中找不到 SetIterable 类型的 containsAny() 方法。有吗?
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();
}
但我只是想知道一个是否已经存在。
【问题讨论】:
-
正在处理一个拉取请求,并有望在今年某个时候及时完成 11.0 版本。 github.com/eclipse/eclipse-collections/pull/1010