public final class ArrayExtensions extends Object
ArrayExtensions is an extensions class for use with array objects.| Constructor and Description |
|---|
ArrayExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
asList(T[] array)
Creates a new
List from the given array. |
static <T> T |
getFirst(T[] array)
Gets the first object from the given array.
|
static <T> int |
getIndex(T[] array,
T element)
Gets the index of the given element in the given array.
|
static <T> T |
getLast(T[] array)
Gets the last object from the given array.
|
static <T> int |
getNextIndex(T[] array,
T element)
Gets the next index of the given array.
|
static <T> int[] |
getNextIndexes(T[] array,
T element,
int count)
Gets the next indexes from the given count of the given array.
|
static <T> int |
getPreviousIndex(T[] array,
T element)
Gets the previous index of the given array.
|
static <T> int[] |
getPreviousIndexes(T[] array,
T element,
int count)
Gets the previous indexes from the given count of the given array.
|
static <T> int |
indexOf(T[] array,
T element)
Gets the index of the given element in the given array.
|
static <T> boolean |
isFirst(T[] array,
T element)
Checks if the given element is the first in the given array.
|
static <T> boolean |
isLast(T[] array,
T element)
Checks if the given element is the last in the given array.
|
static <T> T[] |
newArray(T... elements)
Factory method for create new array from the given optional elements.
|
static byte[][] |
splitInChunks(byte[] bytes,
int chunkSize)
Split the given byte array in to new arrays with the chunk size.
|
static <T> List<T> |
toList(T[] array)
Creates a new
List from the given array. |
public static <T> List<T> asList(T[] array)
List from the given array. Arrays.asList(Object...).T - the generic type of the objects in the array.array - the arrayList created from the given array.public static <T> T getFirst(T[] array)
T - the generic typearray - the array.public static <T> int getIndex(T[] array,
T element)
T - the generic typearray - the arrayelement - the elementpublic static <T> T getLast(T[] array)
T - the generic typearray - the array.public static <T> int getNextIndex(T[] array,
T element)
T - the generic typearray - the arrayelement - the elementpublic static <T> int[] getNextIndexes(T[] array,
T element,
int count)
T - the generic typearray - the arrayelement - the elementcount - the countpublic static <T> int getPreviousIndex(T[] array,
T element)
T - the generic typearray - the arrayelement - the elementpublic static <T> int[] getPreviousIndexes(T[] array,
T element,
int count)
T - the generic typearray - the arrayelement - the elementcount - the countpublic static <T> int indexOf(T[] array,
T element)
T - the generic typearray - the arrayelement - the elementpublic static <T> boolean isFirst(T[] array,
T element)
T - the generic typearray - the arrayelement - the elementpublic static <T> boolean isLast(T[] array,
T element)
T - the generic typearray - the arrayelement - the element@SafeVarargs public static <T> T[] newArray(T... elements)
T - the generic type of the elementselements - the optional elements that will be in the returned array.public static byte[][] splitInChunks(byte[] bytes,
int chunkSize)
bytes - the byteschunkSize - the chunk sizepublic static <T> List<T> toList(T[] array)
List from the given array. Arrays.asList(Object...).T - the generic type of the objects in the array.array - the arrayList created from the given array.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.