public class ObjectSet<T>
extends java.lang.Object
implements java.lang.Iterable<T>
Modifier and Type | Class and Description |
---|---|
static class |
ObjectSet.SetIterator<K> |
Modifier and Type | Field and Description |
---|---|
int |
size |
Constructor and Description |
---|
ObjectSet()
Creates a new set with an initial capacity of 32 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T key)
Returns true if the key was not already in the set.
|
void |
addAll(Array<T> array) |
void |
addAll(ObjectSet<T> set) |
void |
clear() |
void |
clear(int maximumCapacity)
Clears the map 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 acommodate the specified number of additional items.
|
ObjectSet.SetIterator<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) |
public ObjectSet()
public ObjectSet(int initialCapacity)
public ObjectSet(int initialCapacity, float loadFactor)
public boolean add(T key)
public boolean remove(T key)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean contains(T key)
public void ensureCapacity(int additionalCapacity)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String separator)
public ObjectSet.SetIterator<T> iterator()
ObjectSet.SetIterator
constructor for nested or multithreaded iteration.iterator
in interface java.lang.Iterable<T>