public class ArrayUtils extends Object
| Constructor and Description |
|---|
ArrayUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
isInArray(T[] array,
T value)
Will validate if a value is in an array.
|
static String[] |
removeAll(String[] array,
String remove,
boolean trim)
Remove all elements from an array which is equal to a string value.
|
static <T> T[] |
toArray(List<T> list)
Converts a generic list to an array.
|
static <T> String |
toString(T[] a,
String divider)
A toString builder for a list of
T's divided by divider. |
public static String[] removeAll(String[] array, String remove, boolean trim) throws NullPointerException
array - the array to iterate overremove - the string value to compare with, if equal then it is remove from the array,trim - should the element be trimmed before compare.NullPointerException - if the array or any array elemennt is null.public static final <T> boolean isInArray(T[] array,
T value)
array - the array of elements of type T, null elements is ignored.value - the value.false if the array is empty or null, or the value is null, or it do not exists in array using equal method, otherwise true.public static <T> String toString(T[] a, String divider)
T's divided by divider.a - a list T objects.divider - the string that will divide the toString objects.toString()] divided by [divider]. If object at index x is null than [null] is returned.public static <T> T[] toArray(List<T> list)
list - the List of <T>.null, if the list is null, otherwise the list as an array.