public class ArrayUtils extends Object
| Constructor and Description |
|---|
ArrayUtils() |
| Modifier and Type | Method and Description |
|---|---|
<T> T[] |
checkArray(T... array)
Checks if an array is declared and throws an exception if not.
|
<T> T[] |
combineArrays(T[] array,
T[]... extraArrays)
Combines an array with one or more additional arrays into a new
array of the same type.
|
<T,R> @NotNull List<R> |
fromArray(java.util.function.Function<T,? extends R> function,
T... array) |
<T> @NotNull List<T> |
fromArray(T... array)
Converts an array to a list without applying any operator.
|
<T> @NotNull List<T> |
fromArray(java.util.function.UnaryOperator<T> operator,
T... array)
Converts an array to a list and applies an optional operator to each element.
|
<T> boolean |
isArrayEmpty(T... array)
Checks if an array is empty or null.
|
<T> T[] |
toArray(Iterable<? extends T> iterable)
Converts an iterable to an array.
|
@SafeVarargs public <T> T[] combineArrays(@NotNull T[] array, T[]... extraArrays)
T - the type of the elements in the arraysarray - the first array to be combinedextraArrays - the other arrays to be combined@SafeVarargs public <T> boolean isArrayEmpty(T... array)
T - the type of the elements in the arrayarray - the array to be checked@SafeVarargs public <T> T[] checkArray(T... array)
T - the type of the elements in the arrayarray - the array to be checkedIllegalArgumentException - if the array is null or has zero length@SafeVarargs @NotNull public <T> @NotNull List<T> fromArray(java.util.function.UnaryOperator<T> operator, T... array)
T - the type of the elements in the array and the listoperator - the operator to be applied to each element, can be nullarray - the array to be convertedIllegalArgumentException - if the array is null or has zero length@SafeVarargs @NotNull public <T> @NotNull List<T> fromArray(T... array)
T - the type of the elements in the array and the listarray - the array to be convertedIllegalArgumentException - if the array is null or has zero length@SafeVarargs @NotNull public <T,R> @NotNull List<R> fromArray(java.util.function.Function<T,? extends R> function, T... array)
public <T> T[] toArray(Iterable<? extends T> iterable)
T - the type of the elements in the iterable and the arrayiterable - the iterable to be convertedNullPointerException - if the iterable is nullCopyright © 2023. All rights reserved.