public class Sets extends Collections
Modifier and Type | Method and Description |
---|---|
static <E> Set<E> |
as(Enumeration<E> iterator) |
static <E> Set<E> |
as(Iterator<E> iterator) |
static <E> Set<E> |
def(Set<E> set) |
static <E> Set<E> |
def(Set<E> set,
Set<E> def) |
static <E> Set<E> |
def(Set<E> set,
Supplier<Set<E>> def) |
static <E> Set<E> |
distinct(Collection<E> c,
Function<E,?> keyGetter)
集合去重 -> set
|
static <E> Set<E> |
empty() |
static <E> E |
get(Set<E> set,
int i)
从set获取元素
|
static <E,V> Set<E> |
map(List<V> l,
Function<V,E> mapper) |
static <E> void |
merge(Set<E> source,
Set<E>... setArray)
合并set
|
static BitSet |
newBitSet() |
static BitSet |
newBitSet(int initialSize) |
static <E> ConcurrentHashSet<E> |
newCurrentSet() |
static <E> ConcurrentHashSet<E> |
newCurrentSet(Collection<? extends E> c) |
static <E> ConcurrentHashSet<E> |
newCurrentSet(int capacity) |
static <E> ConcurrentHashSet<E> |
newCurrentSet(Map<? extends E,?> m) |
static <E> MutableHashSet<E> |
newMutableSet() |
static <E> MutableHashSet<E> |
newMutableSet(Collection<? extends E> c) |
static <E> MutableHashSet<E> |
newMutableSet(int capacity) |
static <E> MutableTreeSet<E> |
newMutableTreeSet() |
static <E> MutableTreeSet<E> |
newMutableTreeSet(Collection<? extends E> c) |
static <E> MutableTreeSet<E> |
newMutableTreeSet(Comparator<? super E> comparator) |
static <E> MutableTreeSet<E> |
newMutableTreeSet(SortedSet<E> s) |
static <E> Set<E> |
newSet() |
static <E> Set<E> |
newSet(Collection<? extends E> c) |
static <E> Set<E> |
newSet(int capacity) |
static <E> Set<E> |
newSynchronizedSet() |
static <E> Set<E> |
newSynchronizedSet(Set<E> set) |
static <E> SortedSet<E> |
newSynchronizedSortedSet() |
static <E> SortedSet<E> |
newSynchronizedSortedSet(SortedSet<E> set) |
static <E> TreeSet<E> |
newTreeSet() |
static <E> TreeSet<E> |
newTreeSet(Collection<? extends E> c) |
static <E> TreeSet<E> |
newTreeSet(Comparator<? super E> comparator) |
static <E> TreeSet<E> |
newTreeSet(SortedSet<E> s) |
static <E> Set<E> |
of(E... array) |
static <E,V> Set<E> |
of(Function<V,E> mapper,
V... values) |
static <E> Set<Set<E>> |
partition(Set<E> set,
int size)
set 分片
|
static <E> E |
random(Set<E> set)
从set随机获取一个元素
|
static <E> void |
removeToSize(Set<E> set,
int size)
删除元素到指定大小
|
static <E> Set<E> |
singleton(E e) |
static <E> Set<E> |
unmodified(Set<? extends E> c) |
static <E> Set<E> |
unmodified(SortedSet<E> c) |
compact, contains, containsAll, diff, diff, diffAll, exclude, fill, fill, fill, first, forEach, getDuplicateItems, getFirstDuplicateItem, inter, isAllEmpty, isEmpty, isNoneEmpty, isNotEmpty, join, join, join, last, max, max, min, min, newSynchronizedCollection, size, stream, union, unmodified
public static <E> Set<E> newSet()
public static <E> Set<E> newSet(int capacity)
public static <E> Set<E> newSet(Collection<? extends E> c)
public static <E> TreeSet<E> newTreeSet()
public static <E> TreeSet<E> newTreeSet(Comparator<? super E> comparator)
public static <E> TreeSet<E> newTreeSet(Collection<? extends E> c)
public static <E> MutableHashSet<E> newMutableSet()
public static <E> MutableHashSet<E> newMutableSet(int capacity)
public static <E> MutableHashSet<E> newMutableSet(Collection<? extends E> c)
public static <E> MutableTreeSet<E> newMutableTreeSet()
public static <E> MutableTreeSet<E> newMutableTreeSet(Comparator<? super E> comparator)
public static <E> MutableTreeSet<E> newMutableTreeSet(SortedSet<E> s)
public static <E> MutableTreeSet<E> newMutableTreeSet(Collection<? extends E> c)
public static <E> Set<E> newSynchronizedSet()
public static <E> SortedSet<E> newSynchronizedSortedSet()
public static BitSet newBitSet()
public static BitSet newBitSet(int initialSize)
public static <E> ConcurrentHashSet<E> newCurrentSet()
public static <E> ConcurrentHashSet<E> newCurrentSet(int capacity)
public static <E> ConcurrentHashSet<E> newCurrentSet(Collection<? extends E> c)
public static <E> ConcurrentHashSet<E> newCurrentSet(Map<? extends E,?> m)
public static <E> Set<E> singleton(E e)
public static <E> Set<E> empty()
@SafeVarargs public static <E> Set<E> of(E... array)
@SafeVarargs public static <E,V> Set<E> of(Function<V,E> mapper, V... values)
public static <E> Set<E> as(Enumeration<E> iterator)
@SafeVarargs public static <E> void merge(Set<E> source, Set<E>... setArray)
E
- ignoresource
- 合并到的 setsetArray
- 需要合并的 setpublic static <E> E get(Set<E> set, int i)
E
- ignoreset
- seti
- indexpublic static <E> E random(Set<E> set)
E
- ignoreset
- setpublic static <E> void removeToSize(Set<E> set, int size)
E
- Eset
- setsize
- 大小public static <E> Set<Set<E>> partition(Set<E> set, int size)
E
- Eset
- setsize
- sizepublic static <E> Set<E> distinct(Collection<E> c, Function<E,?> keyGetter)
E
- Ec
- ckeyGetter
- keyGetterCopyright © 2024. All rights reserved.