public final class ArrayUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
append(T[] array1,
T[] array2)
Appends 2 arrays.
|
static void |
boundsCheck(int capacity,
int index,
int length)
Bounds check when copying to/from a buffer
|
static <T> void |
concat(T[] sourceFirst,
T[] sourceSecond,
T[] dest)
Copies in order
sourceFirst and sourceSecond into dest . |
static <T> boolean |
contains(T[] array,
T item) |
static <T> void |
copyWithoutNulls(T[] src,
T[] dst)
Copy src array into destination and skip null values.
|
static <T> T[] |
createCopy(T[] src)
Create copy of the src array.
|
static <T> T |
getItemAtPositionOrNull(T[] array,
int position) |
static <T> T[] |
remove(T[] src,
T object)
Removes an item from the array.
|
static <T> T[] |
replaceFirst(T[] src,
T oldValue,
T[] newValues)
Replaces the first occurrence of the oldValue by the newValue.
|
public static <T> T[] createCopy(T[] src)
T
- src
- public static <T> T[] remove(T[] src, T object)
T
- the type of the arraysrc
- the src arrayobject
- the object to removepublic static <T> T[] append(T[] array1, T[] array2)
T
- the type of the arrayarray1
- the first arrayarray2
- the second arraypublic static <T> T[] replaceFirst(T[] src, T oldValue, T[] newValues)
T
- the type of the arraysrc
- oldValue
- the value to look fornewValues
- the value that is inserted.public static <T> void copyWithoutNulls(T[] src, T[] dst)
src.length - getNoOfNullItems(src)
T
- src
- source arraydst
- destination. It has to have the right capacitypublic static <T> boolean contains(T[] array, T item)
public static <T> T getItemAtPositionOrNull(T[] array, int position)
public static <T> void concat(T[] sourceFirst, T[] sourceSecond, T[] dest)
sourceFirst
and sourceSecond
into dest
.T
- sourceFirst
- sourceSecond
- dest
- public static void boundsCheck(int capacity, int index, int length)
capacity
- capacity of the bufferindex
- index of copying will start from/tolength
- length of the buffer that will be read/writenCopyright © 2019 Hazelcast, Inc.. All Rights Reserved.