public class CharArray extends Object
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
add(char value) |
void |
add(char value1,
char value2) |
void |
add(char value1,
char value2,
char value3) |
void |
add(char value1,
char value2,
char value3,
char value4) |
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(Object object)
Returns false if either array is unordered.
|
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) |
boolean |
isEmpty()
Returns true if the array is empty.
|
int |
lastIndexOf(char value) |
void |
mul(int index,
char value) |
boolean |
notEmpty()
Returns true if the array has one or more items.
|
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) |
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() |
String |
toString() |
String |
toString(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 add(char value1, char value2)
public void add(char value1, char value2, char value3)
public void add(char value1, char value2, char value3, char value4)
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 boolean notEmpty()
public boolean isEmpty()
public void clear()
public char[] shrink()
items
public char[] ensureCapacity(int additionalCapacity)
items
public char[] setSize(int newSize)
items
public void sort()
public void reverse()
public void shuffle()
public void truncate(int newSize)
public char random()
public char[] toArray()
public boolean equals(Object object)
public static CharArray with(char... array)
CharArray(char[])
Copyright © 2019. All rights reserved.