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