Class OkkamArrays


  • public class OkkamArrays
    extends Object
    • Method Detail

      • indexOf

        public static <T> int indexOf​(T[] array,
                                      T valueToFind)
        Get the position of the object in an array.
        Type Parameters:
        T - The input type
        Parameters:
        array - The input array
        valueToFind - The value to find
        Returns:
        the position into the array. -1 otherwise.
      • toArrayList

        public static <T> List<T> toArrayList​(T[] sourceArray)
        Transform the input array into an ArrayList.
        Type Parameters:
        T - The input type
        Parameters:
        sourceArray - The input array
        Returns:
        The list composed by the element of the input array
      • toArrayListStartingWith

        @SafeVarargs
        public static <T> List<T> toArrayListStartingWith​(T[] array,
                                                          T... elems)
        Transform the array into an ArrayList, prepending a set of elements.
        Type Parameters:
        T - The input type
        Parameters:
        array - The input array
        elems - The elements to prepend
        Returns:
        The list composed by the element of the input array
      • toArrayListEndingWith

        public static <T> List<T> toArrayListEndingWith​(T[] array,
                                                        T... elements)
        Transform the array into an ArrayList, appending a set of elements.
        Type Parameters:
        T - The input type
        Parameters:
        array - The input array
        elements - The elements to append
        Returns:
        The list composed by the element of the input array
      • addAll

        public static <T> T[] addAll​(T[] array,
                                     T... elements)
        Append elements to an array.
        Type Parameters:
        T - The input type
        Parameters:
        array - The array
        elements - The elements to append
        Returns:
        The new array
      • addAll

        public static <T> T[] addAll​(T[] array,
                                     List<T> addElmts)
        Append a List of elements to an array.
        Type Parameters:
        T - The input type
        Parameters:
        array - The array
        addElmts - The List of elements to append
        Returns:
        The new array