java.lang.Object
ushiosan.jvm.internal.collections.arrays.generic.UArraysGeneric
ushiosan.jvm.internal.collections.arrays.primitives.UArrayPrimitive
ushiosan.jvm.collections.UArray
- All Implemented Interfaces:
UArraysConstants
-
Field Summary
Fields inherited from interface ushiosan.jvm.internal.collections.arrays.UArraysConstants
BYTE_EMPTY, CHAR_EMPTY, DOUBLE_EMPTY, EMPTY_SIZE, FLOAT_EMPTY, INDEX_NOT_FOUND, INT_EMPTY, LONG_EMPTY, OBJ_EMPTY, SHORT_EMPTY -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean[]makeBoolean(boolean... elements) Generate a primitive boolean arraystatic boolean @NotNull []makeBooleanObj(Boolean @NotNull ... elements) Generate a primitive boolean arraystatic byte @NotNull []Generate a primitive byte arraystatic byte @NotNull []makeByteObj(Byte @NotNull ... elements) Generate a primitive byte arraystatic char[]makeChar(char... elements) Generate a primitive char arraystatic char @NotNull []makeCharObj(Character @NotNull ... elements) Generate a primitive char arraystatic double[]makeDouble(double... elements) Generate a primitive double arraystatic double @NotNull []makeDoubleObj(Double @NotNull ... elements) Generate a primitive double arraystatic float[]makeFloat(float... elements) Generate a primitive float arraystatic float @NotNull []makeFloatObj(Float @NotNull ... elements) Generate a primitive float arraystatic int[]makeInt(int... elements) Generate a primitive int arraystatic int @NotNull []makeIntObj(Integer @NotNull ... elements) Generate a primitive int arraystatic long[]makeLong(long... elements) Generate a primitive long arraystatic long @NotNull []makeLongObj(Long @NotNull ... elements) Generate a primitive long arraystatic short @NotNull []Generate a primitive short arraystatic short @NotNull []makeShortObj(Short @NotNull ... elements) Generate a primitive short arraystatic booleanprimitiveContains(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Checks if the array contains the selected element.static booleanprimitiveContains(char @NotNull [] array, char element) Checks if the array contains the selected element.static booleanprimitiveContains(double @NotNull [] array, double element) Checks if the array contains the selected element.static booleanprimitiveContains(float @NotNull [] array, float element) Checks if the array contains the selected element.static booleanprimitiveContains(int @NotNull [] array, int element) Checks if the array contains the selected element.static booleanprimitiveContains(long @NotNull [] array, long element) Checks if the array contains the selected element.static booleanprimitiveContains(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Checks if the array contains the selected element.static booleanprimitiveContentEquals(byte[] ar1, byte[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(char[] ar1, char[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(double[] ar1, double[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(float[] ar1, float[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(int[] ar1, int[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(long[] ar1, long[] ar2) Verify that the contents of two arrays are the samestatic booleanprimitiveContentEquals(short[] ar1, short[] ar2) Verify that the contents of two arrays are the samestatic intprimitiveIndexOf(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Search elements in the arraystatic intprimitiveIndexOf(char @NotNull [] array, char element) Search elements in the arraystatic intprimitiveIndexOf(double @NotNull [] array, double element) Search elements in the arraystatic intprimitiveIndexOf(float @NotNull [] array, float element) Search elements in the arraystatic intprimitiveIndexOf(int @NotNull [] array, int element) Search elements in the arraystatic intprimitiveIndexOf(long @NotNull [] array, long element) Search elements in the arraystatic intprimitiveIndexOf(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Search elements in the arrayprimitiveLastElement(byte @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(char @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(double @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(float @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(int @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(long @NotNull [] array) Returns the last element of the arrayprimitiveLastElement(short @NotNull [] array) Returns the last element of the arraystatic intprimitiveLastIndexOf(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Search an element in the array.static intprimitiveLastIndexOf(char @NotNull [] array, char element) Search an element in the array.static intprimitiveLastIndexOf(double @NotNull [] array, double element) Search an element in the array.static intprimitiveLastIndexOf(float @NotNull [] array, float element) Search an element in the array.static intprimitiveLastIndexOf(int @NotNull [] array, int element) Search an element in the array.static intprimitiveLastIndexOf(long @NotNull [] array, long element) Search an element in the array.static intprimitiveLastIndexOf(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Search an element in the array.primitiveTransform(boolean[] original, @NotNull Function<Boolean, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(boolean[] original, @NotNull Function<Boolean, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(byte[] original, @NotNull Function<Byte, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(byte[] original, @NotNull Function<Byte, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(double[] original, @NotNull Function<Double, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(double[] original, @NotNull Function<Double, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(float[] original, @NotNull Function<Float, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(float[] original, @NotNull Function<Float, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(int[] original, @NotNull Function<Integer, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(int[] original, @NotNull Function<Integer, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(long[] original, @NotNull Function<Long, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(long[] original, @NotNull Function<Long, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.primitiveTransform(short[] original, @NotNull Function<Short, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []primitiveTransform(short[] original, @NotNull Function<Short, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.PrimitiveTransform(char[] original, @NotNull Function<Character, T> mapper) Converts one array to another but with a different data type.static <T> T @NotNull []PrimitiveTransform(char[] original, @NotNull Function<Character, T> mapper, @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.static byteprimitiveUnsafeLastElement(byte @NotNull [] array) Returns the last element of the arraystatic charprimitiveUnsafeLastElement(char @NotNull [] array) Returns the last element of the arraystatic doubleprimitiveUnsafeLastElement(double @NotNull [] array) Returns the last element of the arraystatic floatprimitiveUnsafeLastElement(float @NotNull [] array) Returns the last element of the arraystatic intprimitiveUnsafeLastElement(int @NotNull [] array) Returns the last element of the arraystatic longprimitiveUnsafeLastElement(long @NotNull [] array) Returns the last element of the arraystatic shortprimitiveUnsafeLastElement(short @NotNull [] array) Returns the last element of the arraystatic int @NotNull []primitiveUnsignedByteArray(byte[] array) Gets a new array but removing the sign to only get positive integers and not get invalid data.static Boolean[]toObjectArray(boolean[] array) Convert any array to an object array.toObjectArray(byte[] array) Convert any array to an object array.toObjectArray(char[] array) Convert any array to an object array.toObjectArray(double[] array) Convert any array to an object array.toObjectArray(float[] array) Convert any array to an object array.toObjectArray(int[] array) Convert any array to an object array.toObjectArray(long[] array) Convert any array to an object array.toObjectArray(short[] array) Convert any array to an object array.Methods inherited from class ushiosan.jvm.internal.collections.arrays.primitives.UArrayPrimitive
toGenericObjectArray, toObjectArrayImplMethods inherited from class ushiosan.jvm.internal.collections.arrays.generic.UArraysGeneric
contains, contentEquals, indexOf, join, join, joinAll, joinAll, lastElement, lastIndexOf, make, make, makeEmpty, transform, transform, unsafeLastElement
-
Method Details
-
makeDouble
public static double[] makeDouble(double... elements) Generate a primitive double array- Parameters:
elements- double elements- Returns:
- an array with double bytes
-
makeDoubleObj
Generate a primitive double array- Parameters:
elements- double elements- Returns:
- an array with double bytes
-
primitiveIndexOf
Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveLastIndexOf
Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveContains
Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(double[] original, @NotNull @NotNull Function<Double, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(double[] original, @NotNull @NotNull Function<Double, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(double[] ar1, double[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeFloat
public static float[] makeFloat(float... elements) Generate a primitive float array- Parameters:
elements- float elements- Returns:
- an array with all float elements
-
makeFloatObj
Generate a primitive float array- Parameters:
elements- float elements- Returns:
- an array with all float elements
-
primitiveIndexOf
Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveLastIndexOf
Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveContains
Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(float[] original, @NotNull @NotNull Function<Float, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(float[] original, @NotNull @NotNull Function<Float, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(float[] ar1, float[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeLong
public static long[] makeLong(long... elements) Generate a primitive long array- Parameters:
elements- long elements- Returns:
- an array with all long elements
-
makeLongObj
Generate a primitive long array- Parameters:
elements- long elements- Returns:
- an array with all long elements
-
primitiveIndexOf
Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveLastIndexOf
Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveContains
Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(long[] original, @NotNull @NotNull Function<Long, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(long[] original, @NotNull @NotNull Function<Long, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(long[] ar1, long[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeInt
public static int[] makeInt(int... elements) Generate a primitive int array- Parameters:
elements- int elements- Returns:
- an array with all int elements
-
makeIntObj
Generate a primitive int array- Parameters:
elements- int elements- Returns:
- an array with all int elements
-
primitiveIndexOf
Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveLastIndexOf
Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveContains
Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(int[] original, @NotNull @NotNull Function<Integer, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(int[] original, @NotNull @NotNull Function<Integer, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(int[] ar1, int[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeShort
Generate a primitive short array- Parameters:
elements- short elements- Returns:
- an array with all shot elements
-
makeShortObj
Generate a primitive short array- Parameters:
elements- short elements- Returns:
- an array with all shot elements
-
primitiveIndexOf
public static int primitiveIndexOf(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveLastIndexOf
public static int primitiveLastIndexOf(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if the element not exists
-
primitiveContains
public static boolean primitiveContains(short @NotNull [] array, @org.jetbrains.annotations.Range(from=-32768L, to=32767L) int element) Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(short[] original, @NotNull @NotNull Function<Short, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(short[] original, @NotNull @NotNull Function<Short, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(short[] ar1, short[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeByte
Generate a primitive byte array- Parameters:
elements- byte elements- Returns:
- an array with all bytes
-
makeByteObj
Generate a primitive byte array- Parameters:
elements- byte elements- Returns:
- an array with all bytes
-
primitiveIndexOf
public static int primitiveIndexOf(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveLastIndexOf
public static int primitiveLastIndexOf(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
UArraysConstants.INDEX_NOT_FOUNDif an element not exists
-
primitiveContains
public static boolean primitiveContains(byte @NotNull [] array, @org.jetbrains.annotations.Range(from=-128L, to=127L) int element) Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(byte[] original, @NotNull @NotNull Function<Byte, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(byte[] original, @NotNull @NotNull Function<Byte, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(byte[] ar1, byte[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
primitiveUnsignedByteArray
Gets a new array but removing the sign to only get positive integers and not get invalid data.- Parameters:
array- the array you want to transform- Returns:
- the result of the conversion to positive unsigned integers
-
makeChar
public static char[] makeChar(char... elements) Generate a primitive char array- Parameters:
elements- char elements- Returns:
- an array with all char elements
-
makeCharObj
Generate a primitive char array- Parameters:
elements- char elements- Returns:
- an array with all char elements
-
primitiveIndexOf
Search elements in the array- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveLastIndexOf
Search an element in the array. This method tries to search in reverse, first starting at the end of the array, to find the desired element.- Parameters:
array- base array to searchelement- the element to search- Returns:
- the first index element or
-1if an element not exists
-
primitiveContains
Checks if the array contains the selected element.- Parameters:
array- base array to searchelement- the element to search- Returns:
trueif the element exists orfalseotherwise
-
primitiveLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array or
Optional.empty()if array is empty
-
primitiveUnsafeLastElement
Returns the last element of the array- Parameters:
array- base array to search- Returns:
- the last element of the array
- Throws:
IllegalStateException- if the array is empty
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
PrimitiveTransform
public static <T> T @NotNull [] PrimitiveTransform(char[] original, @NotNull @NotNull Function<Character, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
PrimitiveTransform
public static <T> Object @NotNull [] PrimitiveTransform(char[] original, @NotNull @NotNull Function<Character, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-
primitiveContentEquals
public static boolean primitiveContentEquals(char[] ar1, char[] ar2) Verify that the contents of two arrays are the same- Parameters:
ar1- the array to checkar2- the array to check- Returns:
trueif the content is the same orfalseif the size is different or the content is different
-
makeBoolean
public static boolean[] makeBoolean(boolean... elements) Generate a primitive boolean array- Parameters:
elements- boolean elements- Returns:
- an array with all boolean elements
-
makeBooleanObj
Generate a primitive boolean array- Parameters:
elements- int elements- Returns:
- an array with all boolean elements
-
toObjectArray
Convert any array to an object array. This also applies to primitive types.- Parameters:
array- the array to convert- Returns:
- a converted array object
-
primitiveTransform
public static <T> T @NotNull [] primitiveTransform(boolean[] original, @NotNull @NotNull Function<Boolean, T> mapper, @NotNull @NotNull IntFunction<T[]> arrFn) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the arrayarrFn- function that generates the required type of array- Returns:
- the new array with the converted data
-
primitiveTransform
public static <T> Object @NotNull [] primitiveTransform(boolean[] original, @NotNull @NotNull Function<Boolean, T> mapper) Converts one array to another but with a different data type.- Type Parameters:
T- the original data type- Parameters:
original- the original array that you want to convertmapper- function in charge of transforming each element of the array- Returns:
- the new array with the converted data
-