|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.utils.IntSet
public class IntSet
An unordered set that uses int keys. This implementation uses cuckoo hashing using 3 hashes, random walking, and a small stash
for problematic keys. No allocation is done except when growing the table size.
This set performs very fast contains and remove (typically O(1), worst case O(log(n))). Add may be a bit slower, depending on
hash collisions. Load factors greater than 0.91 greatly increase the chances the set will have to rehash to the next higher POT
size.
Nested Class Summary | |
---|---|
static class |
IntSet.Entry<V>
|
static class |
IntSet.IntSetIterator
|
Field Summary | |
---|---|
int |
size
|
Constructor Summary | |
---|---|
IntSet()
Creates a new sets with an initial capacity of 32 and a load factor of 0.8. |
|
IntSet(int initialCapacity)
Creates a new set with a load factor of 0.8. |
|
IntSet(int initialCapacity,
float loadFactor)
Creates a new set with the specified initial capacity and load factor. |
Method Summary | |
---|---|
boolean |
add(int key)
Returns true if the key was not already in the 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(int key)
|
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to acommodate the specified number of additional items. |
IntSet.IntSetIterator |
iterator()
Returns an iterator for the keys in the set. |
void |
putAll(IntSet set)
|
boolean |
remove(int 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. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int size
Constructor Detail |
---|
public IntSet()
public IntSet(int initialCapacity)
public IntSet(int initialCapacity, float loadFactor)
Method Detail |
---|
public boolean add(int key)
public void putAll(IntSet set)
public boolean remove(int key)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean contains(int key)
public void ensureCapacity(int additionalCapacity)
public String toString()
toString
in class Object
public IntSet.IntSetIterator iterator()
IntSet.IntSetIterator
constructor for nested or multithreaded iteration.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |