Class ArrayHelper<E>
- java.lang.Object
-
- org.teichert.databaseexplorer.utils.ArrayHelper<E>
-
- Type Parameters:
E
-
public class ArrayHelper<E> extends Object
Helper-class for using arrays.
-
-
Constructor Summary
Constructors Constructor Description ArrayHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getArrayAsString(String split, E... array)
Returns the given array as a string.boolean
improveArrays(E[] array1, E[] array2)
Checks the contents of two arrays.boolean
improveItemInArray(E obj, E... array)
Checks whether an item is present in the passed array.
If so,true
is returned, otherwisefalse
.boolean
isArrayEmpty(E[] array)
Returnstrue
if the array is empty,false
otherwise.
-
-
-
Method Detail
-
getArrayAsString
public String getArrayAsString(String split, E... array)
Returns the given array as a string. Thestring split
is appended to the array for each item.
If split == null, a System.lineseparator is taken!- Parameters:
split
-array
-- Returns:
-
improveItemInArray
public boolean improveItemInArray(E obj, E... array)
Checks whether an item is present in the passed array.
If so,true
is returned, otherwisefalse
.- Parameters:
obj
-array
-- Returns:
-
improveArrays
public boolean improveArrays(E[] array1, E[] array2)
Checks the contents of two arrays. These must be the same size!
If the contents from the array1 are all the same with the contents
(regardless of the position of the respective items in the two lists!)
are array2true
is returned, otherwisefalse
.- Parameters:
array1
-array2
-- Returns:
-
isArrayEmpty
public boolean isArrayEmpty(E[] array)
Returnstrue
if the array is empty,false
otherwise.- Parameters:
array
-- Returns:
-
-