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_ARRAYAn empty immutableActionItemarray.static AnimationPropertyKey[]EMPTY_ANIMATION_PROPERTY_ARRAYAn empty immutableAnimationPropertyKeyarray.static boolean[]EMPTY_BOOLEAN_ARRAYAn empty immutablebooleanarray.static Boolean[]EMPTY_BOOLEAN_OBJECT_ARRAYAn empty immutableBooleanarray.static BorderAlign[]EMPTY_BORDER_ALIGN_ARRAYAn empty immutableBorderAlignarray.static BorderSkipped[]EMPTY_BORDER_SKIPPED_ARRAYAn empty immutableBorderSkippedarray.static IsColor[]EMPTY_COLORS_ARRAYAn empty immutableIsColorarray.static DataPoint[]EMPTY_DATA_POINT_ARRAYAn empty immutableDataPointarray.static Date[]EMPTY_DATE_ARRAYAn empty immutableDatearray.static double[]EMPTY_DOUBLE_ARRAYAn empty immutabledoublearray.static Double[]EMPTY_DOUBLE_OBJECT_ARRAYAn empty immutableDoublearray.static EventButton[]EMPTY_EVENT_BUTTON_ARRAYAn empty immutableEventButtonarray.static int[]EMPTY_INT_ARRAYAn empty immutableintarray.static Integer[]EMPTY_INTEGER_OBJECT_ARRAYAn empty immutableIntegerarray.static Key[]EMPTY_KEY_ARRAYAn empty immutableKeyarray.static MeasureUnit[]EMPTY_MEASURE_UNIT_ARRAYAn empty immutableMeasureUnitarray.static String[]EMPTY_STRING_ARRAYAn empty immutableStringarray.static TimeSeriesItem[]EMPTY_TIME_SERIES_ITEM_ARRAYAn empty immutableTimeSeriesItemarray.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetLength(Object array)Returns the length of the passed array.
If argument isnull, 0 is returned.static booleanisEmpty(boolean[] array)Returnstrueif the array is empty.static booleanisEmpty(double[] array)Returnstrueif the array is empty.static booleanisEmpty(int[] array)Returnstrueif the array is empty.static booleanisEmpty(Object[] array)Returnstrueif the array is empty.static booleanisNotEmpty(boolean[] array)Returnstrueif the array is empty.static booleanisNotEmpty(double[] array)Returnstrueif the array is empty.static booleanisNotEmpty(int[] array)Returnstrueif the array is empty.static booleanisNotEmpty(Object[] array)Returnstrueif 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 EventButton[]toEventButtons(List<EventButton> list)Returns an array of dates 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 immutablebooleanarray.
-
EMPTY_BOOLEAN_OBJECT_ARRAY
public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY
An empty immutableBooleanarray.
-
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAY
An empty immutabledoublearray.
-
EMPTY_DOUBLE_OBJECT_ARRAY
public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY
An empty immutableDoublearray.
-
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAY
An empty immutableintarray.
-
EMPTY_INTEGER_OBJECT_ARRAY
public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY
An empty immutableIntegerarray.
-
EMPTY_DATA_POINT_ARRAY
public static final DataPoint[] EMPTY_DATA_POINT_ARRAY
An empty immutableDataPointarray.
-
EMPTY_TIME_SERIES_ITEM_ARRAY
public static final TimeSeriesItem[] EMPTY_TIME_SERIES_ITEM_ARRAY
An empty immutableTimeSeriesItemarray.
-
EMPTY_COLORS_ARRAY
public static final IsColor[] EMPTY_COLORS_ARRAY
An empty immutableIsColorarray.
-
EMPTY_BORDER_SKIPPED_ARRAY
public static final BorderSkipped[] EMPTY_BORDER_SKIPPED_ARRAY
An empty immutableBorderSkippedarray.
-
EMPTY_BORDER_ALIGN_ARRAY
public static final BorderAlign[] EMPTY_BORDER_ALIGN_ARRAY
An empty immutableBorderAlignarray.
-
EMPTY_MEASURE_UNIT_ARRAY
public static final MeasureUnit[] EMPTY_MEASURE_UNIT_ARRAY
An empty immutableMeasureUnitarray.
-
EMPTY_ANIMATION_PROPERTY_ARRAY
public static final AnimationPropertyKey[] EMPTY_ANIMATION_PROPERTY_ARRAY
An empty immutableAnimationPropertyKeyarray.
-
EMPTY_ACTION_ITEM_ARRAY
public static final ActionItem[] EMPTY_ACTION_ITEM_ARRAY
An empty immutableActionItemarray.
-
EMPTY_EVENT_BUTTON_ARRAY
public static final EventButton[] EMPTY_EVENT_BUTTON_ARRAY
An empty immutableEventButtonarray.
-
-
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)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isEmpty
public static boolean isEmpty(double[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isEmpty
public static boolean isEmpty(int[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isEmpty
public static boolean isEmpty(Object[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isNotEmpty
public static boolean isNotEmpty(boolean[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isNotEmpty
public static boolean isNotEmpty(double[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isNotEmpty
public static boolean isNotEmpty(int[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif the array is empty
-
isNotEmpty
public static boolean isNotEmpty(Object[] array)
Returnstrueif the array is empty.- Parameters:
array- the array to check- Returns:
trueif 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
-
toEventButtons
public static EventButton[] toEventButtons(List<EventButton> list)
Returns an array of dates from a list.- Parameters:
list- list of objects to transform- Returns:
- an array of dates from a list
-
-