| 限定符和类型 | 类和说明 |
|---|---|
protected class |
Array2DHashSet.SetIterator |
| 限定符和类型 | 字段和说明 |
|---|---|
protected T[][] |
buckets |
protected AbstractEqualityComparator<? super T> |
comparator |
protected int |
currentPrime |
static int |
INITAL_BUCKET_CAPACITY |
static int |
INITAL_CAPACITY |
protected int |
initialBucketCapacity |
protected int |
initialCapacity |
static double |
LOAD_FACTOR |
protected int |
n
How many elements in set
|
protected int |
threshold
when to expand
|
| 构造器和说明 |
|---|
Array2DHashSet() |
Array2DHashSet(AbstractEqualityComparator<? super T> comparator) |
Array2DHashSet(AbstractEqualityComparator<? super T> comparator,
int initialCapacity,
int initialBucketCapacity) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> c) |
protected T |
asElementType(Object o)
Return
o as an instance of the element type T. |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> collection) |
boolean |
containsFast(T obj) |
protected T[] |
createBucket(int capacity)
Return an array of
T with length capacity. |
protected T[][] |
createBuckets(int capacity)
Return an array of
T[] with length capacity. |
boolean |
equals(Object o) |
protected void |
expand() |
T |
get(T o) |
protected int |
getBucket(T o) |
T |
getOrAdd(T o)
Add
o to set if not there; return existing value if already
there. |
protected T |
getOrAddImpl(T o) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeFast(T obj) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
T[] |
toArray() |
<U> U[] |
toArray(U[] a) |
String |
toString() |
String |
toTableString() |
spliteratorparallelStream, removeIf, streampublic static final int INITAL_CAPACITY
public static final int INITAL_BUCKET_CAPACITY
public static final double LOAD_FACTOR
@NotNull protected final AbstractEqualityComparator<? super T> comparator
protected T[][] buckets
protected int n
protected int currentPrime
protected int threshold
protected final int initialCapacity
protected final int initialBucketCapacity
public Array2DHashSet()
public Array2DHashSet(@Nullable
AbstractEqualityComparator<? super T> comparator)
public Array2DHashSet(@Nullable
AbstractEqualityComparator<? super T> comparator,
int initialCapacity,
int initialBucketCapacity)
public final T getOrAdd(T o)
o to set if not there; return existing value if already
there. This method performs the same operation as add(T) aside from
the return value.protected final int getBucket(T o)
public int hashCode()
public boolean equals(Object o)
protected void expand()
public final boolean contains(Object o)
public boolean containsFast(@Nullable
T obj)
public boolean removeFast(@Nullable
T obj)
public boolean containsAll(Collection<?> collection)
containsAll 在接口中 Collection<T>containsAll 在接口中 Set<T>public boolean addAll(Collection<? extends T> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
public String toTableString()
protected T asElementType(Object o)
o as an instance of the element type T. If
o is non-null but known to not be an instance of T, this
method returns null. The base implementation does not perform any
type checks; override this method to provide strong type checks for the
contains(java.lang.Object) and remove(java.lang.Object) methods to ensure the arguments to
the EqualityComparator for the set always have the expected
types.o - the object to try and cast to the element type of the seto if it could be an instance of T, otherwise
null.protected T[][] createBuckets(int capacity)
T[] with length capacity.capacity - the length of the array to returnprotected T[] createBucket(int capacity)
T with length capacity.capacity - the length of the array to returnCopyright © 1992–2022 Daniel Sun. All rights reserved.