public class ConcurrentDelayedRemovalArray<T> extends org.mini2Dx.gdx.utils.DelayedRemovalArray<T> implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentDelayedRemovalArray() |
ConcurrentDelayedRemovalArray(org.mini2Dx.gdx.utils.Array<? extends T> array)
NOTE: read access to the other array is not thread-safe
|
ConcurrentDelayedRemovalArray(boolean ordered,
int capacity) |
ConcurrentDelayedRemovalArray(boolean ordered,
int capacity,
java.lang.Class arrayType) |
ConcurrentDelayedRemovalArray(boolean ordered,
T[] array,
int startIndex,
int count) |
ConcurrentDelayedRemovalArray(java.lang.Class arrayType) |
ConcurrentDelayedRemovalArray(int capacity) |
ConcurrentDelayedRemovalArray(T[] array) |
Modifier and Type | Method and Description |
---|---|
void |
add(T value) |
void |
add(T value1,
T value2) |
void |
add(T value1,
T value2,
T value3) |
void |
add(T value1,
T value2,
T value3,
T value4) |
void |
addAll(org.mini2Dx.gdx.utils.Array<? extends T> array,
int start,
int count) |
void |
addAll(T[] array,
int start,
int count) |
void |
begin() |
void |
clear() |
boolean |
contains(T value,
boolean identity)
Returns true if this array contains the specified value.
|
boolean |
containsAll(org.mini2Dx.gdx.utils.Array<? extends T> values,
boolean identity)
Returns true if this array contains all the specified values.
|
boolean |
containsAny(org.mini2Dx.gdx.utils.Array<? extends T> values,
boolean identity)
Returns true if this array contains any the specified values.
|
void |
end() |
T[] |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object object)
Returns false if either array is unordered.
|
boolean |
equalsIdentity(java.lang.Object object)
Uses == for comparison of each item.
|
T |
first()
Returns the first item.
|
T |
get(int index) |
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
int |
indexOf(T value,
boolean identity)
Returns the index of first occurrence of value in the array, or -1 if no such value exists.
|
void |
insert(int index,
T value) |
boolean |
isEmpty()
Returns true if the array is empty.
|
java.util.Iterator<T> |
iterator()
Returns an iterator for the items in the array.
|
int |
lastIndexOf(T value,
boolean identity)
Returns an index of last occurrence of value in array or -1 if no such value exists.
|
boolean |
notEmpty()
Returns true if the array has one or more items.
|
T |
peek()
Returns the last item.
|
T |
pop() |
T |
random()
Returns a random item from the array, or null if the array is empty.
|
boolean |
removeAll(org.mini2Dx.gdx.utils.Array<? extends T> array,
boolean identity)
Removes from this array all of elements contained in the specified array.
|
T |
removeIndex(int index) |
void |
removeRange(int start,
int end) |
boolean |
removeValue(T value,
boolean identity) |
void |
reverse() |
java.lang.Iterable<T> |
select(org.mini2Dx.gdx.utils.Predicate<T> predicate)
Returns an iterable for the selected items in the array.
|
T |
selectRanked(java.util.Comparator<T> comparator,
int kthLowest)
Selects the nth-lowest element from the Array according to Comparator ranking.
|
int |
selectRankedIndex(java.util.Comparator<T> comparator,
int kthLowest) |
void |
set(int index,
T value) |
T[] |
setSize(int newSize) |
T[] |
shrink()
Reduces the size of the backing array to the size of the actual items.
|
void |
shuffle() |
void |
sort() |
void |
sort(java.util.Comparator<? super T> comparator) |
void |
swap(int first,
int second) |
T[] |
toArray()
Returns the items as an array.
|
<V> V[] |
toArray(java.lang.Class<V> type) |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
void |
truncate(int newSize) |
protected ReadWriteLock lock
public ConcurrentDelayedRemovalArray()
public ConcurrentDelayedRemovalArray(org.mini2Dx.gdx.utils.Array<? extends T> array)
array
- public ConcurrentDelayedRemovalArray(boolean ordered, int capacity, java.lang.Class arrayType)
public ConcurrentDelayedRemovalArray(boolean ordered, int capacity)
public ConcurrentDelayedRemovalArray(boolean ordered, T[] array, int startIndex, int count)
public ConcurrentDelayedRemovalArray(java.lang.Class arrayType)
public ConcurrentDelayedRemovalArray(int capacity)
public ConcurrentDelayedRemovalArray(T[] array)
public void begin()
begin
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void end()
end
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public boolean removeValue(T value, boolean identity)
removeValue
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public T removeIndex(int index)
removeIndex
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void removeRange(int start, int end)
removeRange
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void clear()
clear
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void set(int index, T value)
set
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void insert(int index, T value)
insert
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void swap(int first, int second)
swap
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void sort()
sort
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void sort(java.util.Comparator<? super T> comparator)
sort
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void reverse()
reverse
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void shuffle()
shuffle
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void truncate(int newSize)
truncate
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public T[] setSize(int newSize)
setSize
in class org.mini2Dx.gdx.utils.DelayedRemovalArray<T>
public void add(T value1, T value2, T value3)
add
in class org.mini2Dx.gdx.utils.Array<T>
public void add(T value1, T value2, T value3, T value4)
add
in class org.mini2Dx.gdx.utils.Array<T>
public void addAll(org.mini2Dx.gdx.utils.Array<? extends T> array, int start, int count)
addAll
in class org.mini2Dx.gdx.utils.Array<T>
public void addAll(T[] array, int start, int count)
addAll
in class org.mini2Dx.gdx.utils.Array<T>
public boolean contains(T value, boolean identity)
contains
in class org.mini2Dx.gdx.utils.Array<T>
value
- May be null.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public boolean containsAll(org.mini2Dx.gdx.utils.Array<? extends T> values, boolean identity)
containsAll
in class org.mini2Dx.gdx.utils.Array<T>
values
- May contains nulls.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public boolean containsAny(org.mini2Dx.gdx.utils.Array<? extends T> values, boolean identity)
containsAny
in class org.mini2Dx.gdx.utils.Array<T>
values
- May contains nulls.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public int indexOf(T value, boolean identity)
indexOf
in class org.mini2Dx.gdx.utils.Array<T>
value
- May be null.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public int lastIndexOf(T value, boolean identity)
lastIndexOf
in class org.mini2Dx.gdx.utils.Array<T>
value
- May be null.identity
- If true, == comparison will be used. If false, .equals() comparison will be used.public boolean removeAll(org.mini2Dx.gdx.utils.Array<? extends T> array, boolean identity)
removeAll
in class org.mini2Dx.gdx.utils.Array<T>
array
- identity
- True to use ==, false to use .equals().public T first()
first
in class org.mini2Dx.gdx.utils.Array<T>
public boolean notEmpty()
notEmpty
in class org.mini2Dx.gdx.utils.Array<T>
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.Array<T>
public T[] shrink()
shrink
in class org.mini2Dx.gdx.utils.Array<T>
Array.items
public T[] ensureCapacity(int additionalCapacity)
ensureCapacity
in class org.mini2Dx.gdx.utils.Array<T>
additionalCapacity
- Array.items
public T selectRanked(java.util.Comparator<T> comparator, int kthLowest)
GdxRuntimeException
will be thrown.selectRanked
in class org.mini2Dx.gdx.utils.Array<T>
comparator
- used for comparisonkthLowest
- rank of desired object according to comparison, n is based on ordinal numbers, not array indices. for min
value use 1, for max value use size of array, using 0 results in runtime exception.Select
public int selectRankedIndex(java.util.Comparator<T> comparator, int kthLowest)
selectRankedIndex
in class org.mini2Dx.gdx.utils.Array<T>
comparator
- used for comparisonkthLowest
- rank of desired object according to comparison, n is based on ordinal numbers, not array indices. for min
value use 1, for max value use size of array, using 0 results in runtime exception.Array.selectRanked(Comparator, int)
public java.util.Iterator<T> iterator()
public java.lang.Iterable<T> select(org.mini2Dx.gdx.utils.Predicate<T> predicate)
If Collections.allocateIterators
is false, the same iterable instance is returned each time this method is called.
Use the Predicate.PredicateIterable
constructor for nested or multithreaded iteration.
select
in class org.mini2Dx.gdx.utils.Array<T>
predicate
- public T random()
random
in class org.mini2Dx.gdx.utils.Array<T>
public T[] toArray()
ConcurrentDelayedRemovalArray(Class)
constructor must have been used.
Otherwise use toArray(Class)
to specify the array type.toArray
in class org.mini2Dx.gdx.utils.Array<T>
public <V> V[] toArray(java.lang.Class<V> type)
toArray
in class org.mini2Dx.gdx.utils.Array<T>
public int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.Array<T>
public boolean equals(java.lang.Object object)
equals
in class org.mini2Dx.gdx.utils.Array<T>
object
- public boolean equalsIdentity(java.lang.Object object)
equalsIdentity
in class org.mini2Dx.gdx.utils.Array<T>
object
- public java.lang.String toString()
toString
in class org.mini2Dx.gdx.utils.Array<T>
public java.lang.String toString(java.lang.String separator)
toString
in class org.mini2Dx.gdx.utils.Array<T>
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock