public class CharArray
extends java.lang.Object
构造器和说明 |
---|
CharArray()
Creates an ordered array with a capacity of 16.
|
CharArray(boolean ordered,
char[] array,
int startIndex,
int count)
Creates a new array containing the elements in the specified array.
|
CharArray(boolean ordered,
int capacity) |
CharArray(char[] array)
Creates a new ordered array containing the elements in the specified array.
|
CharArray(CharArray array)
Creates a new array containing the elements in the specific array.
|
CharArray(int capacity)
Creates an ordered array with the specified capacity.
|
限定符和类型 | 方法和说明 |
---|---|
void |
add(char value) |
void |
addAll(char... array) |
void |
addAll(char[] array,
int offset,
int length) |
void |
addAll(CharArray array) |
void |
addAll(CharArray array,
int offset,
int length) |
void |
clear() |
boolean |
contains(char value) |
char[] |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object object) |
char |
first()
Returns the first item.
|
char |
get(int index) |
int |
hashCode() |
void |
incr(int index,
char value) |
int |
indexOf(char value) |
void |
insert(int index,
char value) |
int |
lastIndexOf(char value) |
void |
mul(int index,
char value) |
char |
peek()
Returns the last item.
|
char |
pop()
Removes and returns the last item.
|
char |
random()
Returns a random item from the array, or zero if the array is empty.
|
boolean |
removeAll(CharArray array)
Removes from this array all of elements contained in the specified array.
|
char |
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(char value) |
protected char[] |
resize(int newSize) |
void |
reverse() |
void |
set(int index,
char value) |
char[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size undefined.
|
char[] |
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) |
char[] |
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 CharArray |
with(char... array) |
public CharArray()
public CharArray(int capacity)
public CharArray(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 CharArray(CharArray array)
public CharArray(char[] array)
public CharArray(boolean ordered, char[] 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(char value)
public void addAll(CharArray array)
public void addAll(CharArray array, int offset, int length)
public void addAll(char... array)
public void addAll(char[] array, int offset, int length)
public char get(int index)
public void set(int index, char value)
public void incr(int index, char value)
public void mul(int index, char value)
public void insert(int index, char value)
public void swap(int first, int second)
public boolean contains(char value)
public int indexOf(char value)
public int lastIndexOf(char value)
public boolean removeValue(char value)
public char removeIndex(int index)
public void removeRange(int start, int end)
public boolean removeAll(CharArray array)
public char pop()
public char peek()
public char first()
public void clear()
public char[] shrink()
items
public char[] ensureCapacity(int additionalCapacity)
items
public char[] setSize(int newSize)
items
protected char[] resize(int newSize)
public void sort()
public void reverse()
public void shuffle()
public void truncate(int newSize)
public char random()
public char[] 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 CharArray with(char... array)
CharArray(char[])