Class ArrayUtil
- java.lang.Object
-
- org.pepstock.charba.client.commons.ArrayUtil
-
public class ArrayUtil extends Object
Utility to transform arrays and list of objects to primitives.
The code has been changed in order to be aligned with internal needs, taking the source from ArrayUtils of Apache common lang3..
-
-
Field Summary
Fields Modifier and Type Field Description static ActionItem[]
EMPTY_ACTION_ITEM_ARRAY
An empty immutableActionItem
array.static AnimationPropertyKey[]
EMPTY_ANIMATION_PROPERTY_ARRAY
An empty immutableAnimationPropertyKey
array.static boolean[]
EMPTY_BOOLEAN_ARRAY
An empty immutableboolean
array.static Boolean[]
EMPTY_BOOLEAN_OBJECT_ARRAY
An empty immutableBoolean
array.static BorderAlign[]
EMPTY_BORDER_ALIGN_ARRAY
An empty immutableBorderAlign
array.static BorderSkipped[]
EMPTY_BORDER_SKIPPED_ARRAY
An empty immutableBorderSkipped
array.static IsColor[]
EMPTY_COLORS_ARRAY
An empty immutableIsColor
array.static DataPoint[]
EMPTY_DATA_POINT_ARRAY
An empty immutableDataPoint
array.static Date[]
EMPTY_DATE_ARRAY
An empty immutableDate
array.static double[]
EMPTY_DOUBLE_ARRAY
An empty immutabledouble
array.static Double[]
EMPTY_DOUBLE_OBJECT_ARRAY
An empty immutableDouble
array.static int[]
EMPTY_INT_ARRAY
An empty immutableint
array.static Integer[]
EMPTY_INTEGER_OBJECT_ARRAY
An empty immutableInteger
array.static Key[]
EMPTY_KEY_ARRAY
An empty immutableKey
array.static MeasureUnit[]
EMPTY_MEASURE_UNIT_ARRAY
An empty immutableMeasureUnit
array.static String[]
EMPTY_STRING_ARRAY
An empty immutableString
array.static TimeSeriesItem[]
EMPTY_TIME_SERIES_ITEM_ARRAY
An empty immutableTimeSeriesItem
array.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getLength(Object array)
Returns the length of the passed array.
If argument isnull
, 0 is returned.static boolean
isEmpty(boolean[] array)
Returnstrue
if the array is empty.static boolean
isEmpty(double[] array)
Returnstrue
if the array is empty.static boolean
isEmpty(int[] array)
Returnstrue
if the array is empty.static boolean
isEmpty(Object[] array)
Returnstrue
if the array is empty.static boolean
isNotEmpty(boolean[] array)
Returnstrue
if the array is empty.static boolean
isNotEmpty(double[] array)
Returnstrue
if the array is empty.static boolean
isNotEmpty(int[] array)
Returnstrue
if the array is empty.static boolean
isNotEmpty(Object[] array)
Returnstrue
if the array is empty.static ActionItem[]
toActionItems(List<ActionItem> list)
Returns an array of dates from a list.static AnimationPropertyKey[]
toAnimationProperties(List<AnimationPropertyKey> list)
Returns an array of dates from a list.static boolean[]
toBooleans(List<Boolean> list)
Returns an array of primitives from a list.static BorderAlign[]
toBorderAlign(List<BorderAlign> list)
Returns an array of dates from a list.static BorderSkipped[]
toBorderSkipped(List<BorderSkipped> list)
Returns an array of dates from a list.static IsColor[]
toColors(List<IsColor> list)
Returns an array of dates from a list.static DataPoint[]
toDataPoints(List<DataPoint> list)
Returns an array of dates from a list.static Date[]
toDates(List<Date> list)
Returns an array of dates from a list.static double[]
toDoubles(List<Double> list)
Returns an array of primitives from a list.static int[]
toIntegers(List<Integer> list)
Returns an array of primitives from a list.static Key[]
toKeys(List<Key> list)
Returns an array of dates from a list.static MeasureUnit[]
toMeasureUnits(List<MeasureUnit> list)
Returns an array of dates from a list.static boolean[]
toPrimitive(Boolean[] array)
Returns an array of primitives from an array of objects.static double[]
toPrimitive(Double[] array)
Returns an array of primitives from an array of objects.static int[]
toPrimitive(Integer[] array)
Returns an array of primitives from an array of objects.static String[]
toStrings(List<String> list)
Returns an array of strings from a list.static TimeSeriesItem[]
toTimeSeriesItems(List<TimeSeriesItem> list)
Returns an array of dates from a list.
-
-
-
Field Detail
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAY
An empty immutableboolean
array.
-
EMPTY_BOOLEAN_OBJECT_ARRAY
public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY
An empty immutableBoolean
array.
-
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAY
An empty immutabledouble
array.
-
EMPTY_DOUBLE_OBJECT_ARRAY
public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY
An empty immutableDouble
array.
-
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAY
An empty immutableint
array.
-
EMPTY_INTEGER_OBJECT_ARRAY
public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY
An empty immutableInteger
array.
-
EMPTY_DATA_POINT_ARRAY
public static final DataPoint[] EMPTY_DATA_POINT_ARRAY
An empty immutableDataPoint
array.
-
EMPTY_TIME_SERIES_ITEM_ARRAY
public static final TimeSeriesItem[] EMPTY_TIME_SERIES_ITEM_ARRAY
An empty immutableTimeSeriesItem
array.
-
EMPTY_COLORS_ARRAY
public static final IsColor[] EMPTY_COLORS_ARRAY
An empty immutableIsColor
array.
-
EMPTY_BORDER_SKIPPED_ARRAY
public static final BorderSkipped[] EMPTY_BORDER_SKIPPED_ARRAY
An empty immutableBorderSkipped
array.
-
EMPTY_BORDER_ALIGN_ARRAY
public static final BorderAlign[] EMPTY_BORDER_ALIGN_ARRAY
An empty immutableBorderAlign
array.
-
EMPTY_MEASURE_UNIT_ARRAY
public static final MeasureUnit[] EMPTY_MEASURE_UNIT_ARRAY
An empty immutableMeasureUnit
array.
-
EMPTY_ANIMATION_PROPERTY_ARRAY
public static final AnimationPropertyKey[] EMPTY_ANIMATION_PROPERTY_ARRAY
An empty immutableAnimationPropertyKey
array.
-
EMPTY_ACTION_ITEM_ARRAY
public static final ActionItem[] EMPTY_ACTION_ITEM_ARRAY
An empty immutableActionItem
array.
-
-
Method Detail
-
getLength
public static int getLength(Object array)
Returns the length of the passed array.
If argument isnull
, 0 is returned.- Parameters:
array
- the array to get the length- Returns:
- the length of the array
-
isEmpty
public static boolean isEmpty(boolean[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isEmpty
public static boolean isEmpty(double[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isEmpty
public static boolean isEmpty(int[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isEmpty
public static boolean isEmpty(Object[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isNotEmpty
public static boolean isNotEmpty(boolean[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isNotEmpty
public static boolean isNotEmpty(double[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isNotEmpty
public static boolean isNotEmpty(int[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
isNotEmpty
public static boolean isNotEmpty(Object[] array)
Returnstrue
if the array is empty.- Parameters:
array
- the array to check- Returns:
true
if the array is empty
-
toBooleans
public static boolean[] toBooleans(List<Boolean> list)
Returns an array of primitives from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of primitives from a list
-
toPrimitive
public static boolean[] toPrimitive(Boolean[] array)
Returns an array of primitives from an array of objects.- Parameters:
array
- array of objects to transform- Returns:
- an array of primitives from passed array
-
toDoubles
public static double[] toDoubles(List<Double> list)
Returns an array of primitives from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of primitives from a list
-
toPrimitive
public static double[] toPrimitive(Double[] array)
Returns an array of primitives from an array of objects.- Parameters:
array
- array of objects to transform- Returns:
- an array of primitives from passed array
-
toIntegers
public static int[] toIntegers(List<Integer> list)
Returns an array of primitives from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of primitives from a list
-
toPrimitive
public static int[] toPrimitive(Integer[] array)
Returns an array of primitives from an array of objects.- Parameters:
array
- array of objects to transform- Returns:
- an array of primitives from passed array
-
toStrings
public static String[] toStrings(List<String> list)
Returns an array of strings from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of strings from a list
-
toDates
public static Date[] toDates(List<Date> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toDataPoints
public static DataPoint[] toDataPoints(List<DataPoint> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toTimeSeriesItems
public static TimeSeriesItem[] toTimeSeriesItems(List<TimeSeriesItem> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toColors
public static IsColor[] toColors(List<IsColor> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toBorderSkipped
public static BorderSkipped[] toBorderSkipped(List<BorderSkipped> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toBorderAlign
public static BorderAlign[] toBorderAlign(List<BorderAlign> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toKeys
public static Key[] toKeys(List<Key> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toMeasureUnits
public static MeasureUnit[] toMeasureUnits(List<MeasureUnit> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toAnimationProperties
public static AnimationPropertyKey[] toAnimationProperties(List<AnimationPropertyKey> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
toActionItems
public static ActionItem[] toActionItems(List<ActionItem> list)
Returns an array of dates from a list.- Parameters:
list
- list of objects to transform- Returns:
- an array of dates from a list
-
-