Class ArrayListHelper


  • public final class ArrayListHelper
    extends Object
    Utility to create array list objects from java script arrays.
    Author:
    Andrea "Stock" Stocchero
    • 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 of IsColor).
        Parameters:
        values - array of elements to load when the list is creating.
        Returns:
        a array list of strings instance
      • list

        public static <E extends KeyArrayEnumList<E> list​(E[] enumValues,
                                                            E[] values)
        Creates a array list of enumeration values (instance of Key).
        Type Parameters:
        E - type of key
        Parameters:
        enumValues - all possible values of an enumeration
        values - array of elements to load when the list is creating.
        Returns:
        a array list of values
      • list

        public static <E extends KeyArrayEnumList<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 enumeration
        array - array of strings to load when the list is creating.
        Returns:
        a array list of values.
      • keys

        public static <E extends KeyArrayKeyList<E> keys​(ArrayString array,
                                                           KeyFactory<E> factory)
        Creates a array list of Key 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 NativeObjectContainerArrayObjectContainerList<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 KeyList<E> unmodifiableList​(E[] enumValues,
                                                               E[] values)
        Creates an unmodifiable array list of enumeration values (instance of Key).
        Type Parameters:
        E - type of key
        Parameters:
        enumValues - all possible values of an enumeration
        values - array of elements to load when the list is creating.
        Returns:
        a array list of values
      • unmodifiableList

        public static <E extends KeyList<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 enumeration
        array - array of strings to load when the list is creating.
        Returns:
        a array list of values
      • unmodifiableKeys

        public static <E extends KeyList<E> unmodifiableKeys​(ArrayString array,
                                                               KeyFactory<E> factory)
        Creates a unmodifiable array list of Key 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 NativeObjectContainerList<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