public class LongArray
extends java.lang.Object
构造器和说明 |
---|
LongArray()
Creates an ordered array with a capacity of 16.
|
LongArray(boolean ordered,
int capacity) |
LongArray(boolean ordered,
long[] array,
int startIndex,
int count)
Creates a new array containing the elements in the specified array.
|
LongArray(int capacity)
Creates an ordered array with the specified capacity.
|
LongArray(long[] array)
Creates a new ordered array containing the elements in the specified array.
|
LongArray(LongArray array)
Creates a new array containing the elements in the specific array.
|
限定符和类型 | 方法和说明 |
---|---|
void |
add(long value) |
void |
addAll(long... array) |
void |
addAll(long[] array,
int offset,
int length) |
void |
addAll(LongArray array) |
void |
addAll(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) |
long |
first()
Returns the first item.
|
long |
get(int index) |
int |
hashCode() |
void |
incr(int index,
long value) |
int |
indexOf(long value) |
void |
insert(int index,
long value) |
int |
lastIndexOf(char value) |
void |
mul(int index,
long value) |
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(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) |
protected long[] |
resize(int newSize) |
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.
|
static LongArray |
with(long... array) |
public LongArray()
public LongArray(int capacity)
public LongArray(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 LongArray(LongArray array)
public LongArray(long[] array)
public LongArray(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.public void add(long value)
public void addAll(LongArray array)
public void addAll(LongArray array, int offset, int length)
public void addAll(long... array)
public void addAll(long[] array, int offset, int length)
public long get(int index)
public void set(int index, long value)
public void incr(int index, long value)
public void mul(int index, long value)
public void insert(int index, long value)
public void swap(int first, int second)
public boolean contains(long value)
public int indexOf(long value)
public int lastIndexOf(char value)
public boolean removeValue(long value)
public long removeIndex(int index)
public void removeRange(int start, int end)
public boolean removeAll(LongArray array)
public long pop()
public long peek()
public long first()
public void clear()
public long[] shrink()
items
public long[] ensureCapacity(int additionalCapacity)
items
public long[] setSize(int newSize)
items
protected long[] resize(int newSize)
public void sort()
public void reverse()
public void shuffle()
public void truncate(int newSize)
public long random()
public long[] toArray()
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object object)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
public java.lang.String toString(java.lang.String separator)
public static LongArray with(long... array)
LongArray(long[])