public class OrderedSet<T> extends ObjectSet<T>
ObjectSet
that also stores keys in an Array
using the insertion order. There is some additional overhead
for put and remove. Iteration
is ordered and faster than an unordered set. Keys can also be accessed and
the order changed using orderedItems()
.限定符和类型 | 类和说明 |
---|---|
static class |
OrderedSet.OrderedSetIterator<T> |
ObjectSet.ObjectSetIterator<K>
构造器和说明 |
---|
OrderedSet() |
OrderedSet(int initialCapacity) |
OrderedSet(int initialCapacity,
float loadFactor) |
OrderedSet(OrderedSet set) |
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(T key)
Returns true if the key was not already in the set.
|
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.
|
OrderedSet.OrderedSetIterator<T> |
iterator()
Returns an iterator for the keys in the set.
|
Array<T> |
orderedItems() |
boolean |
remove(T key)
Returns true if the key was removed.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
public OrderedSet()
public OrderedSet(int initialCapacity, float loadFactor)
public OrderedSet(int initialCapacity)
public OrderedSet(OrderedSet set)
public boolean add(T key)
ObjectSet
public void clear(int maximumCapacity)
ObjectSet
public OrderedSet.OrderedSetIterator<T> iterator()
ObjectSet
ObjectSet.ObjectSetIterator
constructor for nested or multithreaded iteration.