E
- 元素类型public class ConcurrentHashSet<E> extends AbstractSet<E> implements Serializable
SafeConcurrentHashMap
实现的线程安全HashSetConstructor and Description |
---|
ConcurrentHashSet()
构造
触发因子为默认的0.75 |
ConcurrentHashSet(int initialCapacity)
构造
触发因子为默认的0.75 |
ConcurrentHashSet(int initialCapacity,
float loadFactor)
构造
|
ConcurrentHashSet(int initialCapacity,
float loadFactor,
int concurrencyLevel)
构造
|
ConcurrentHashSet(Iterable<E> iter)
从已有集合中构造
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public 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
in interface Collection<E>
size
in interface Set<E>
size
in class AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
isEmpty
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class AbstractCollection<E>
public boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in class AbstractCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
Copyright © 2024. All rights reserved.