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