Class ArrayListHelper
- java.lang.Object
-
- org.pepstock.charba.client.commons.ArrayListHelper
-
public final class ArrayListHelper extends Object
Utility to create array list objects from java script arrays.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isConsistent(Collection<?> list)
Checks if the passed list is consistent.static <E extends Key>
ArrayKeyList<E>keys(ArrayString array, KeyFactory<E> factory)
Creates a array list ofKey
values by an java script array of strings.static <E extends Key>
ArrayEnumList<E>list(E[] enumValues, E[] values)
Creates a array list of enumeration values (instance ofKey
).static <E extends Key>
ArrayEnumList<E>list(E[] enumValues, ArrayString array)
Creates a array list of enumeration values by an java script array of strings.static ArrayStringList
list(IsColor... values)
Creates a array list of strings by an array of colors (instance ofIsColor
).static ArrayCanvasList
list(ArrayCanvas values)
Creates a array list of canvas by a java script array of canvas.static ArrayDoubleList
list(ArrayDouble values)
Creates a array list of doubles by a java script array of doubles.static <E extends NativeArrayContainer<ArrayDouble>>
ArrayDoubleArrayList<E>list(ArrayDoubleArray array, NativeArrayContainerFactory<ArrayDouble,E> factory)
Creates a array list of java script native double array container by a java script array and a factory.static ArrayImageList
list(ArrayImage values)
Creates a array list of images by a java script array of images.static ArrayIntegerList
list(ArrayInteger values)
Creates a array list of integers by a java script array of integers.static ArrayObjectList
list(ArrayObject values)
Creates a array list of generic java script objects by a java script array.static <E extends NativeObjectContainer>
ArrayObjectContainerList<E>list(ArrayObject array, NativeObjectContainerFactory<E> factory)
Creates a array list of java script native object container by a java script array and a factory.static ArrayStringList
list(ArrayString values)
Creates a array list of strings by a java script array of strings.static ArrayTouchList
list(ArrayTouch values)
Creates a array list of touches by a java script array of touches.static <E extends Key>
List<E>unmodifiableKeys(ArrayString array, KeyFactory<E> factory)
Creates a unmodifiable array list ofKey
values by an java script array of strings.static <E extends Key>
List<E>unmodifiableList(E[] enumValues, E[] values)
Creates an unmodifiable array list of enumeration values (instance ofKey
).static <E extends Key>
List<E>unmodifiableList(E[] enumValues, ArrayString array)
Creates an unmodifiable array list of enumeration values by an java script array of strings.static List<Canvas>
unmodifiableList(ArrayCanvas values)
Creates a array list of canvas by a java script array of canvas.static List<Double>
unmodifiableList(ArrayDouble values)
Creates an unmodifiable array list of doubles by a java script array of doubles.static <E extends NativeArrayContainer<ArrayDouble>>
List<E>unmodifiableList(ArrayDoubleArray array, NativeArrayContainerFactory<ArrayDouble,E> factory)
Creates an unmodifiable array list of java script native double array container by a java script array and a factory.static List<Img>
unmodifiableList(ArrayImage values)
Creates a array list of images by a java script array of images.static List<Integer>
unmodifiableList(ArrayInteger values)
Creates an unmodifiable array list of integers by a java script array of integers.static List<NativeObject>
unmodifiableList(ArrayObject values)
Creates an unmodifiable array list of generic java script objects by a java script array.static <E extends NativeObjectContainer>
List<E>unmodifiableList(ArrayObject array, NativeObjectContainerFactory<E> factory)
Creates an unmodifiable array list of java script native object container by a java script array and a factory.static List<String>
unmodifiableList(ArrayString values)
Creates a array list of strings by a java script array of strings.static List<Touch>
unmodifiableList(ArrayTouch values)
Creates a array list of touches by a java script array of touches.
-
-
-
Method Detail
-
list
public static ArrayDoubleList list(ArrayDouble values)
Creates a array list of doubles by a java script array of doubles.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of doubles instance
-
list
public static ArrayIntegerList list(ArrayInteger values)
Creates a array list of integers by a java script array of integers.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of integers instance
-
list
public static ArrayStringList list(ArrayString values)
Creates a array list of strings by a java script array of strings.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of strings instance
-
list
public static ArrayImageList list(ArrayImage values)
Creates a array list of images by a java script array of images.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of images instance
-
list
public static ArrayCanvasList list(ArrayCanvas values)
Creates a array list of canvas by a java script array of canvas.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of canvas instance
-
list
public static ArrayTouchList list(ArrayTouch values)
Creates a array list of touches by a java script array of touches.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of touches instance
-
list
public static ArrayStringList list(IsColor... values)
Creates a array list of strings by an array of colors (instance ofIsColor
).- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of strings instance
-
list
public static <E extends Key> ArrayEnumList<E> list(E[] enumValues, E[] values)
Creates a array list of enumeration values (instance ofKey
).- Type Parameters:
E
- type of key- Parameters:
enumValues
- all possible values of an enumerationvalues
- array of elements to load when the list is creating.- Returns:
- a array list of values
-
list
public static <E extends Key> ArrayEnumList<E> list(E[] enumValues, ArrayString array)
Creates a array list of enumeration values by an java script array of strings.- Type Parameters:
E
- type of key- Parameters:
enumValues
- all possible values of an enumerationarray
- array of strings to load when the list is creating.- Returns:
- a array list of values.
-
keys
public static <E extends Key> ArrayKeyList<E> keys(ArrayString array, KeyFactory<E> factory)
Creates a array list ofKey
values by an java script array of strings.- Type Parameters:
E
- type of key- Parameters:
array
- array of strings to load when the list is creating.factory
- factory implementation to create keys by a single native object of the array.- Returns:
- a array list of
Key
.
-
list
public static ArrayObjectList list(ArrayObject values)
Creates a array list of generic java script objects by a java script array.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of strings instance
-
list
public static <E extends NativeObjectContainer> ArrayObjectContainerList<E> list(ArrayObject array, NativeObjectContainerFactory<E> factory)
Creates a array list of java script native object container by a java script array and a factory.- Type Parameters:
E
- type of native object container- Parameters:
array
- array of elements to load when the list is creating.factory
- factory implementation to create containers by a single native object of the array.- Returns:
- the instance of native object containers list
-
list
public static <E extends NativeArrayContainer<ArrayDouble>> ArrayDoubleArrayList<E> list(ArrayDoubleArray array, NativeArrayContainerFactory<ArrayDouble,E> factory)
Creates a array list of java script native double array container by a java script array and a factory.- Type Parameters:
E
- type of native double array container- Parameters:
array
- array of elements to load when the list is creating.factory
- factory implementation to create containers by a single native array of the arrays.- Returns:
- the instance of native double array containers list
-
unmodifiableList
public static List<Double> unmodifiableList(ArrayDouble values)
Creates an unmodifiable array list of doubles by a java script array of doubles.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of doubles instance
-
unmodifiableList
public static List<Integer> unmodifiableList(ArrayInteger values)
Creates an unmodifiable array list of integers by a java script array of integers.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of integers instance
-
unmodifiableList
public static List<String> unmodifiableList(ArrayString values)
Creates a array list of strings by a java script array of strings.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of strings instance
-
unmodifiableList
public static List<Img> unmodifiableList(ArrayImage values)
Creates a array list of images by a java script array of images.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of images instance
-
unmodifiableList
public static List<Canvas> unmodifiableList(ArrayCanvas values)
Creates a array list of canvas by a java script array of canvas.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of canvas instance
-
unmodifiableList
public static List<Touch> unmodifiableList(ArrayTouch values)
Creates a array list of touches by a java script array of touches.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of touches instance
-
unmodifiableList
public static <E extends Key> List<E> unmodifiableList(E[] enumValues, E[] values)
Creates an unmodifiable array list of enumeration values (instance ofKey
).- Type Parameters:
E
- type of key- Parameters:
enumValues
- all possible values of an enumerationvalues
- array of elements to load when the list is creating.- Returns:
- a array list of values
-
unmodifiableList
public static <E extends Key> List<E> unmodifiableList(E[] enumValues, ArrayString array)
Creates an unmodifiable array list of enumeration values by an java script array of strings.- Type Parameters:
E
- type of key- Parameters:
enumValues
- all possible values of an enumerationarray
- array of strings to load when the list is creating.- Returns:
- a array list of values
-
unmodifiableKeys
public static <E extends Key> List<E> unmodifiableKeys(ArrayString array, KeyFactory<E> factory)
Creates a unmodifiable array list ofKey
values by an java script array of strings.- Type Parameters:
E
- type of key- Parameters:
array
- array of strings to load when the list is creating.factory
- factory implementation to create keys by a single native object of the array.- Returns:
- a array list of
Key
.
-
unmodifiableList
public static List<NativeObject> unmodifiableList(ArrayObject values)
Creates an unmodifiable array list of generic java script objects by a java script array.- Parameters:
values
- array of elements to load when the list is creating.- Returns:
- a array list of strings instance
-
unmodifiableList
public static <E extends NativeObjectContainer> List<E> unmodifiableList(ArrayObject array, NativeObjectContainerFactory<E> factory)
Creates an unmodifiable array list of java script native object container by a java script array and a factory.- Type Parameters:
E
- type of native object container- Parameters:
array
- array of elements to load when the list is creating.factory
- factory implementation to create containers by a single native object of the array.- Returns:
- the instance of native object containers list
-
unmodifiableList
public static <E extends NativeArrayContainer<ArrayDouble>> List<E> unmodifiableList(ArrayDoubleArray array, NativeArrayContainerFactory<ArrayDouble,E> factory)
Creates an unmodifiable array list of java script native double array container by a java script array and a factory.- Type Parameters:
E
- type of native double array container- Parameters:
array
- array of elements to load when the list is creating.factory
- factory implementation to create containers by a single native array of the arrays.- Returns:
- the instance of native double array containers list
-
isConsistent
public static boolean isConsistent(Collection<?> list)
Checks if the passed list is consistent.- Parameters:
list
- list to check- Returns:
true
if the list is consistent
-
-