T - The type of the arraypublic abstract class ArrayWrapper<T>
extends java.lang.Object
| Constructor and Description |
|---|
ArrayWrapper(T[] array) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T value)
Add a value to the array.
|
void |
addAll(ArrayWrapper<T> values)
Add values from another
ArrayWrapper to the array. |
void |
addAll(T... values)
Add multiple values to the array.
|
boolean |
contains(int index)
Check if the index is in the array.
|
boolean |
contains(T value)
Check if the value is in the array.
|
T |
get(int index)
Get the value at the index.
|
T |
get(int index,
T def)
Get the value at the index or the default value if the index is not in the array.
|
T[] |
getArray() |
boolean |
getBoolean(int index)
Get the value at the index as a boolean.
|
abstract boolean |
getBoolean(int index,
boolean def)
Get the value at the index as a boolean or the default value if the index is not in the array.
|
byte |
getByte(int index)
Get the value at the index as a byte.
|
abstract byte |
getByte(int index,
byte def)
Get the value at the index as a byte or the default value if the index is not in the array.
|
char |
getChar(int index)
Get the value at the index as a char.
|
abstract char |
getChar(int index,
char def)
Get the value at the index as a char or the default value if the index is not in the array.
|
double |
getDouble(int index)
Get the value at the index as a double.
|
abstract double |
getDouble(int index,
double def)
Get the value at the index as a double or the default value if the index is not in the array.
|
float |
getFloat(int index)
Get the value at the index as a float.
|
abstract float |
getFloat(int index,
float def)
Get the value at the index as a float or the default value if the index is not in the array.
|
int |
getInt(int index)
Get the value at the index as an int.
|
abstract int |
getInt(int index,
int def)
Get the value at the index as an int or the default value if the index is not in the array.
|
long |
getLong(int index)
Get the value at the index as a long.
|
abstract long |
getLong(int index,
long def)
Get the value at the index as a long or the default value if the index is not in the array.
|
short |
getShort(int index)
Get the value at the index as a short.
|
abstract short |
getShort(int index,
short def)
Get the value at the index as a char or the default value if the index is not in the array.
|
abstract boolean |
isBoolean(int index)
Check if the value at the index is a boolean.
|
abstract boolean |
isByte(int index)
Check if the value at the index is a byte.
|
abstract boolean |
isChar(int index)
Check if the value at the index is a char.
|
abstract boolean |
isDouble(int index)
Check if the value at the index is a double.
|
boolean |
isEmpty() |
abstract boolean |
isFloat(int index)
Check if the value at the index is a float.
|
abstract boolean |
isInt(int index)
Check if the value at the index is an int.
|
abstract boolean |
isLong(int index)
Check if the value at the index is a long.
|
boolean |
isNotEmpty() |
abstract boolean |
isShort(int index)
Check if the value at the index is a short.
|
int |
length() |
void |
remove(int index)
Remove a value from the array.
|
void |
remove(T value)
Remove a value from the array.
|
void |
set(int index,
T value)
Set the value at the index.
|
T[] |
slice(int start)
Get a slice of the array starting at the given index.
|
T[] |
slice(int start,
int end)
Get a slice of the array starting at the given index and ending at the given index.
|
public ArrayWrapper(T[] array)
public T[] getArray()
public int length()
public boolean isEmpty()
public boolean isNotEmpty()
public boolean contains(int index)
index - The index to checkpublic boolean contains(T value)
value - The value to checkpublic T get(int index)
index - The index to get the value fromjava.lang.ArrayIndexOutOfBoundsException - If the index is not in the arraypublic T get(int index, T def)
index - The index to get the value fromdef - The default valuepublic void set(int index,
T value)
index - The index to set the value atvalue - The value to setpublic void add(T value)
value - The value to add@SafeVarargs public final void addAll(T... values)
values - The values to addpublic void addAll(ArrayWrapper<T> values)
ArrayWrapper to the array.values - The ArrayWrapper to add the values frompublic void remove(int index)
index - The index to remove the value frompublic void remove(T value)
value - The value to removepublic T[] slice(int start)
start - The index to start atpublic T[] slice(int start, int end)
start - The index to start atend - The index to end atpublic abstract boolean isBoolean(int index)
index - The index to checkpublic abstract boolean isByte(int index)
index - The index to checkpublic abstract boolean isShort(int index)
index - The index to checkpublic abstract boolean isChar(int index)
index - The index to checkpublic abstract boolean isInt(int index)
index - The index to checkpublic abstract boolean isLong(int index)
index - The index to checkpublic abstract boolean isFloat(int index)
index - The index to checkpublic abstract boolean isDouble(int index)
index - The index to checkpublic boolean getBoolean(int index)
false.index - The index to get the value frompublic byte getByte(int index)
0.index - The index to get the value frompublic short getShort(int index)
0.index - The index to get the value frompublic char getChar(int index)
0.index - The index to get the value frompublic int getInt(int index)
0.index - The index to get the value frompublic long getLong(int index)
0.index - The index to get the value frompublic float getFloat(int index)
0.index - The index to get the value frompublic double getDouble(int index)
0.index - The index to get the value frompublic abstract boolean getBoolean(int index,
boolean def)
index - The index to get the value fromdef - The default valuepublic abstract byte getByte(int index,
byte def)
index - The index to get the value fromdef - The default valuepublic abstract short getShort(int index,
short def)
index - The index to get the value fromdef - The default valuepublic abstract char getChar(int index,
char def)
index - The index to get the value fromdef - The default valuepublic abstract int getInt(int index,
int def)
index - The index to get the value fromdef - The default valuepublic abstract long getLong(int index,
long def)
index - The index to get the value fromdef - The default valuepublic abstract float getFloat(int index,
float def)
index - The index to get the value fromdef - The default valuepublic abstract double getDouble(int index,
double def)
index - The index to get the value fromdef - The default value