public class SetKits extends Object
| 构造器和说明 |
|---|
SetKits() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E> Set<E> |
differenceView(Set<E> set1,
Set<?> set2)
set1, set2的差集(在set1,不在set2中的对象)的只读view,不复制产生新的Set对象.
|
static <E> Set<E> |
disjointView(Set<? extends E> set1,
Set<? extends E> set2)
set1, set2的补集(在set1或set2中,但不在交集中的对象,又叫反交集)的只读view,不复制产生新的Set对象.
|
static <T> Set<T> |
emptySetIfNull(Set<T> set)
如果set为null,转化为一个安全的空Set.
|
static <E> Set<E> |
intersectionView(Set<E> set1,
Set<?> set2)
set1, set2的交集(同时在set1和set2的对象)的只读view,不复制产生新的Set对象.
|
static <T> Set<T> |
newSetFromMap(Map<T,Boolean> map)
从Map构造Set的大杀器, 可以用来制造各种Set
copy from vjtools
|
static <E> Set<E> |
unionView(Set<? extends E> set1,
Set<? extends E> set2)
set1, set2的并集(在set1或set2的对象)的只读view,不复制产生新的Set对象.
|
public static <T> Set<T> emptySetIfNull(Set<T> set)
注意返回的Set不可写, 写入会抛出UnsupportedOperationException.
copy from vjtools
T - set - Collections.emptySet()public static <T> Set<T> newSetFromMap(Map<T,Boolean> map)
copy from vjtools
T - map - Collections.newSetFromMap(Map)public static <E> Set<E> unionView(Set<? extends E> set1, Set<? extends E> set2)
如果尝试写入该View会抛出UnsupportedOperationException
copy from vjtools
E - set1 - set2 - public static <E> Set<E> intersectionView(Set<E> set1, Set<?> set2)
如果尝试写入该View会抛出UnsupportedOperationException
copy from vjtools
E - set1 - set2 - public static <E> Set<E> differenceView(Set<E> set1, Set<?> set2)
如果尝试写入该View会抛出UnsupportedOperationException
copy from vjtools
E - set1 - set2 - Copyright © 2020. All rights reserved.