public class ArrayUtil extends Object
| Constructor and Description |
|---|
ArrayUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
flatten(Object array)
Flatten a multi-dimensional array into a one-dimensional array.
|
static int[] |
getDimensions(Object array) |
static Class<?> |
getType(Object array) |
static <F,T> Object |
transformArray(Object array,
Function<F,T> transform,
Class<T> toType)
Transform the values in an array from one type to another using a transformation function.
|
static Object |
unflatten(Object array,
int[] dimensions)
Un-flatten a one-dimensional array into an multi-dimensional array based on the provided dimensions.
|
public static Object flatten(Object array)
array - the array to flatten.public static Object unflatten(Object array, int[] dimensions)
array - the 1-dimensional array to un-flatten.dimensions - the dimensions to un-flatten to.public static int[] getDimensions(Object array)
public static <F,T> Object transformArray(Object array, Function<F,T> transform, Class<T> toType)
Handles multi-dimensional arrays by flattening before the transformation and un-flattening afterwards.
array - the original array.transform - a function that transforms from F to T.toType - the destination type.F to T
using transform.Copyright © 2025. All rights reserved.