Package org.okkam.awesome.utils
Class OkkamArrays
- java.lang.Object
-
- org.okkam.awesome.utils.OkkamArrays
-
public class OkkamArrays extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]addAll(T[] array, List<T> addElmts)Append a List of elements to an array.static <T> T[]addAll(T[] array, T... elements)Append elements to an array.static <T> intindexOf(T[] array, T valueToFind)Get the position of the object in an array.static <T> List<T>toArrayList(T[] sourceArray)Transform the input array into an ArrayList.static <T> List<T>toArrayListEndingWith(T[] array, T... elements)Transform the array into an ArrayList, appending a set of elements.static <T> List<T>toArrayListStartingWith(T[] array, T... elems)Transform the array into an ArrayList, prepending a set of elements.
-
-
-
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 arrayvalueToFind- 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 arrayelems- 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 arrayelements- 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 arrayelements- 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 arrayaddElmts- The List of elements to append- Returns:
- The new array
-
-