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