public final class ArrayUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
UNKNOWN_INDEX |
| Constructor and Description |
|---|
ArrayUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
add(T[] oldElements,
T elementToAdd)
Add an element to an array resulting in a new array.
|
static <T> T[] |
ensureCapacity(T[] oldElements,
int requiredLength)
Ensure an array has the required capacity.
|
static <T> T[] |
newArray(T[] oldElements,
int length)
Allocate a new array of the same type as another array.
|
static <T> T[] |
remove(T[] oldElements,
int index) |
static <T> T[] |
remove(T[] oldElements,
T elementToRemove)
Remove an element from an array resulting in a new array if the element was found otherwise the old array.
|
public static final int UNKNOWN_INDEX
public static <T> T[] add(T[] oldElements,
T elementToAdd)
T - type of the array.oldElements - to have the new element added.elementToAdd - for the new array.public static <T> T[] remove(T[] oldElements,
T elementToRemove)
T - type of the array.oldElements - to have the element removed from.elementToRemove - being searched for by identity semantics.public static <T> T[] remove(T[] oldElements,
int index)
public static <T> T[] newArray(T[] oldElements,
int length)
T - type of the array.oldElements - on which the new array is based.length - of the new array.public static <T> T[] ensureCapacity(T[] oldElements,
int requiredLength)
T - type of the array.oldElements - to ensure that are long enough.requiredLength - to ensure.Copyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.