public class ConcurrentIntArray extends org.mini2Dx.gdx.utils.IntArray implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentIntArray()
Creates an ordered array with a capacity of 16.
|
ConcurrentIntArray(boolean ordered,
int capacity) |
ConcurrentIntArray(boolean ordered,
int[] array,
int startIndex,
int count)
Creates a new array containing the elements in the specified array.
|
ConcurrentIntArray(int capacity)
Creates an ordered array with the specified capacity.
|
ConcurrentIntArray(int[] array)
Creates a new ordered array containing the elements in the specified array.
|
ConcurrentIntArray(org.mini2Dx.gdx.utils.IntArray array)
Creates a new array containing the elements in the specific array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value) |
void |
add(int value1,
int value2) |
void |
add(int value1,
int value2,
int value3) |
void |
add(int value1,
int value2,
int value3,
int value4) |
void |
addAll(int[] array,
int offset,
int length) |
void |
addAll(org.mini2Dx.gdx.utils.IntArray array,
int offset,
int length) |
void |
clear() |
boolean |
contains(int value) |
int[] |
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.
|
int |
first()
Returns the first item.
|
int |
get(int index) |
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
void |
incr(int index,
int value) |
int |
indexOf(int value) |
void |
insert(int index,
int value) |
boolean |
isEmpty()
Returns true if the array is empty.
|
int |
lastIndexOf(int value) |
void |
mul(int index,
int value) |
boolean |
notEmpty()
Returns true if the array has one or more items.
|
int |
peek()
Returns the last item.
|
int |
pop()
Removes and returns the last item.
|
int |
random()
Returns a random item from the array, or zero if the array is empty.
|
boolean |
removeAll(org.mini2Dx.gdx.utils.IntArray array)
Removes from this array all of elements contained in the specified array.
|
int |
removeIndex(int index)
Removes and returns the item at the specified index.
|
void |
removeRange(int start,
int end)
Removes the items between the specified indices, inclusive.
|
boolean |
removeValue(int value) |
void |
reverse() |
void |
set(int index,
int value) |
int[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size undefined.
|
int[] |
shrink()
Reduces the size of the backing array to the size of the actual items.
|
void |
shuffle() |
void |
sort() |
void |
swap(int first,
int second) |
int[] |
toArray() |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
void |
truncate(int newSize)
Reduces the size of the array to the specified size.
|
protected ReadWriteLock lock
public ConcurrentIntArray()
public ConcurrentIntArray(int capacity)
capacity
- public ConcurrentIntArray(boolean ordered, int capacity)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.capacity
- Any elements added beyond this will cause the backing array to be grown.public ConcurrentIntArray(org.mini2Dx.gdx.utils.IntArray array)
array
- public ConcurrentIntArray(int[] array)
array
- public ConcurrentIntArray(boolean ordered, int[] array, int startIndex, int count)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.array
- startIndex
- count
- public void add(int value)
add
in class org.mini2Dx.gdx.utils.IntArray
public void add(int value1, int value2)
add
in class org.mini2Dx.gdx.utils.IntArray
public void add(int value1, int value2, int value3)
add
in class org.mini2Dx.gdx.utils.IntArray
public void add(int value1, int value2, int value3, int value4)
add
in class org.mini2Dx.gdx.utils.IntArray
public void addAll(org.mini2Dx.gdx.utils.IntArray array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.IntArray
public void addAll(int[] array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.IntArray
public int get(int index)
get
in class org.mini2Dx.gdx.utils.IntArray
public void set(int index, int value)
set
in class org.mini2Dx.gdx.utils.IntArray
public void incr(int index, int value)
incr
in class org.mini2Dx.gdx.utils.IntArray
public void mul(int index, int value)
mul
in class org.mini2Dx.gdx.utils.IntArray
public void insert(int index, int value)
insert
in class org.mini2Dx.gdx.utils.IntArray
public void swap(int first, int second)
swap
in class org.mini2Dx.gdx.utils.IntArray
public boolean contains(int value)
contains
in class org.mini2Dx.gdx.utils.IntArray
public int indexOf(int value)
indexOf
in class org.mini2Dx.gdx.utils.IntArray
public int lastIndexOf(int value)
lastIndexOf
in class org.mini2Dx.gdx.utils.IntArray
public boolean removeValue(int value)
removeValue
in class org.mini2Dx.gdx.utils.IntArray
public int removeIndex(int index)
removeIndex
in class org.mini2Dx.gdx.utils.IntArray
index
- public void removeRange(int start, int end)
removeRange
in class org.mini2Dx.gdx.utils.IntArray
start
- end
- public boolean removeAll(org.mini2Dx.gdx.utils.IntArray array)
removeAll
in class org.mini2Dx.gdx.utils.IntArray
array
- public int pop()
pop
in class org.mini2Dx.gdx.utils.IntArray
public int peek()
peek
in class org.mini2Dx.gdx.utils.IntArray
public int first()
first
in class org.mini2Dx.gdx.utils.IntArray
public boolean notEmpty()
notEmpty
in class org.mini2Dx.gdx.utils.IntArray
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.IntArray
public void clear()
clear
in class org.mini2Dx.gdx.utils.IntArray
public int[] shrink()
shrink
in class org.mini2Dx.gdx.utils.IntArray
IntArray.items
public int[] ensureCapacity(int additionalCapacity)
ensureCapacity
in class org.mini2Dx.gdx.utils.IntArray
additionalCapacity
- IntArray.items
public int[] setSize(int newSize)
setSize
in class org.mini2Dx.gdx.utils.IntArray
newSize
- IntArray.items
public void sort()
sort
in class org.mini2Dx.gdx.utils.IntArray
public void reverse()
reverse
in class org.mini2Dx.gdx.utils.IntArray
public void shuffle()
shuffle
in class org.mini2Dx.gdx.utils.IntArray
public void truncate(int newSize)
truncate
in class org.mini2Dx.gdx.utils.IntArray
newSize
- public int random()
random
in class org.mini2Dx.gdx.utils.IntArray
public int[] toArray()
toArray
in class org.mini2Dx.gdx.utils.IntArray
public int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.IntArray
public boolean equals(java.lang.Object object)
equals
in class org.mini2Dx.gdx.utils.IntArray
object
- public java.lang.String toString()
toString
in class org.mini2Dx.gdx.utils.IntArray
public java.lang.String toString(java.lang.String separator)
toString
in class org.mini2Dx.gdx.utils.IntArray
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock