E - 元素类型public class ConcurrentHashSet<E> extends AbstractSet<E> implements Serializable
SafeConcurrentHashMap实现的线程安全HashSet| 构造器和说明 |
|---|
ConcurrentHashSet()
构造
触发因子为默认的0.75 |
ConcurrentHashSet(int initialCapacity)
构造
触发因子为默认的0.75 |
ConcurrentHashSet(int initialCapacity,
float loadFactor)
构造
|
ConcurrentHashSet(int initialCapacity,
float loadFactor,
int concurrencyLevel)
构造
|
ConcurrentHashSet(Iterable<E> iter)
从已有集合中构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringaddAll, containsAll, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic ConcurrentHashSet()
public ConcurrentHashSet(int initialCapacity)
initialCapacity - 初始大小public ConcurrentHashSet(int initialCapacity,
float loadFactor)
initialCapacity - 初始大小loadFactor - 加载因子。此参数决定数据增长时触发的百分比public ConcurrentHashSet(int initialCapacity,
float loadFactor,
int concurrencyLevel)
initialCapacity - 初始大小loadFactor - 触发因子。此参数决定数据增长时触发的百分比concurrencyLevel - 线程并发度public int size()
size 在接口中 Collection<E>size 在接口中 Set<E>size 在类中 AbstractCollection<E>public boolean isEmpty()
isEmpty 在接口中 Collection<E>isEmpty 在接口中 Set<E>isEmpty 在类中 AbstractCollection<E>public boolean contains(Object o)
contains 在接口中 Collection<E>contains 在接口中 Set<E>contains 在类中 AbstractCollection<E>public boolean add(E e)
add 在接口中 Collection<E>add 在接口中 Set<E>add 在类中 AbstractCollection<E>public boolean remove(Object o)
remove 在接口中 Collection<E>remove 在接口中 Set<E>remove 在类中 AbstractCollection<E>public void clear()
clear 在接口中 Collection<E>clear 在接口中 Set<E>clear 在类中 AbstractCollection<E>Copyright © 2022. All rights reserved.