Package dev.prozilla.pine.common.util
Class ArrayUtils
java.lang.Object
dev.prozilla.pine.common.util.ArrayUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> boolean
contains
(E[] array, E element) Checks if an array contains an element.static <E> E
findByString
(E[] array, String string) Finds the element in an array of which the result ofObject.toString()
is equal to a given string.static <E> boolean
overlaps
(E[] arrayA, E[] arrayB) Checks if two arrays have any overlapping elements.
-
Constructor Details
-
ArrayUtils
public ArrayUtils()
-
-
Method Details
-
overlaps
public static <E> boolean overlaps(E[] arrayA, E[] arrayB) Checks if two arrays have any overlapping elements.- Type Parameters:
E
- Type of the array elements- Parameters:
arrayA
- First arrayarrayB
- Second array- Returns:
- True if any of the elements in
arrayA
also appear inarrayB
.
-
contains
public static <E> boolean contains(E[] array, E element) Checks if an array contains an element.- Type Parameters:
E
- Type of the array elements- Returns:
- True if one of the elements of the array is equal to
element
.
-
findByString
Finds the element in an array of which the result ofObject.toString()
is equal to a given string.- Type Parameters:
E
- Type of the array elements- Parameters:
array
- The array to search instring
- The string representation of the element to search for- Returns:
- The element of which the string representation matches
string
, ornull
if there isn't one.
-