public class ObjectSet<T>
extends java.lang.Object
implements java.lang.Iterable<T>
限定符和类型 | 类和说明 |
---|---|
static class |
ObjectSet.ObjectSetIterator<K> |
限定符和类型 | 字段和说明 |
---|---|
int |
size |
构造器和说明 |
---|
ObjectSet()
Creates a new set with an initial capacity of 51 and a load factor of 0.8.
|
ObjectSet(int initialCapacity)
Creates a new set with a load factor of 0.8.
|
ObjectSet(int initialCapacity,
float loadFactor)
Creates a new set with the specified initial capacity and load factor.
|
ObjectSet(ObjectSet set)
Creates a new set identical to the specified set.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(T key)
Returns true if the key was not already in the set.
|
void |
addAll(Array<? extends T> array) |
void |
addAll(Array<? extends T> array,
int offset,
int length) |
void |
addAll(ObjectSet<T> set) |
void |
addAll(T... array) |
void |
addAll(T[] array,
int offset,
int length) |
void |
clear() |
void |
clear(int maximumCapacity)
Clears the set and reduces the size of the backing arrays to be the specified capacity if they are larger.
|
boolean |
contains(T key) |
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object obj) |
T |
first() |
int |
hashCode() |
ObjectSet.ObjectSetIterator<T> |
iterator()
Returns an iterator for the keys in the set.
|
boolean |
remove(T key)
Returns true if the key was removed.
|
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
static <T> ObjectSet<T> |
with(T... array) |
public ObjectSet()
public ObjectSet(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ObjectSet(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ObjectSet(ObjectSet set)
public boolean add(T key)
public void addAll(T... array)
public void addAll(T[] array, int offset, int length)
public boolean remove(T key)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean contains(T key)
public T first()
public void ensureCapacity(int additionalCapacity)
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
public java.lang.String toString(java.lang.String separator)
public ObjectSet.ObjectSetIterator<T> iterator()
ObjectSet.ObjectSetIterator
constructor for nested or multithreaded iteration.iterator
在接口中 java.lang.Iterable<T>
public static <T> ObjectSet<T> with(T... array)