public class ConcurrentObjectSet<T> extends org.mini2Dx.gdx.utils.ObjectSet<T> implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentObjectSet()
Creates a new set with an initial capacity of 51 and a load factor of 0.8.
|
ConcurrentObjectSet(int initialCapacity)
Creates a new set with a load factor of 0.8.
|
ConcurrentObjectSet(int initialCapacity,
float loadFactor)
Creates a new set with the specified initial capacity and load factor.
|
ConcurrentObjectSet(org.mini2Dx.gdx.utils.ObjectSet<? extends T> set)
Creates a new set identical to the specified set.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T key)
Returns true if the key was not already in the set.
|
void |
addAll(org.mini2Dx.gdx.utils.Array<? extends T> array,
int offset,
int length) |
void |
addAll(org.mini2Dx.gdx.utils.ObjectSet<T> set) |
void |
addAll(T[] array,
int offset,
int length) |
void |
clear()
Clears the set, leaving the backing arrays at the current capacity.
|
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() |
T |
get(T key) |
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the set is empty.
|
org.mini2Dx.gdx.utils.ObjectSet.ObjectSetIterator<T> |
iterator()
Returns an iterator for the keys in the set.
|
boolean |
notEmpty()
Returns true if the set has one or more items.
|
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) |
protected ReadWriteLock lock
public ConcurrentObjectSet()
public ConcurrentObjectSet(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ConcurrentObjectSet(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.loadFactor
- public ConcurrentObjectSet(org.mini2Dx.gdx.utils.ObjectSet<? extends T> set)
set
- public boolean add(T key)
add
in class org.mini2Dx.gdx.utils.ObjectSet<T>
key
- public void addAll(org.mini2Dx.gdx.utils.Array<? extends T> array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public void addAll(T[] array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public void addAll(org.mini2Dx.gdx.utils.ObjectSet<T> set)
addAll
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public boolean remove(T key)
remove
in class org.mini2Dx.gdx.utils.ObjectSet<T>
key
- public boolean notEmpty()
notEmpty
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public void shrink(int maximumCapacity)
shrink
in class org.mini2Dx.gdx.utils.ObjectSet<T>
maximumCapacity
- public void clear(int maximumCapacity)
clear
in class org.mini2Dx.gdx.utils.ObjectSet<T>
maximumCapacity
- public void clear()
clear(int)
can be used to reduce the capacity.clear
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public boolean contains(T key)
contains
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public T get(T key)
get
in class org.mini2Dx.gdx.utils.ObjectSet<T>
key
- public void ensureCapacity(int additionalCapacity)
ensureCapacity
in class org.mini2Dx.gdx.utils.ObjectSet<T>
additionalCapacity
- public int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public boolean equals(java.lang.Object obj)
equals
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public java.lang.String toString()
toString
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public java.lang.String toString(java.lang.String separator)
toString
in class org.mini2Dx.gdx.utils.ObjectSet<T>
public org.mini2Dx.gdx.utils.ObjectSet.ObjectSetIterator<T> iterator()
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock