|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.commons.utils.ArrayUtils
public class ArrayUtils
This is a collection of some methods that work with arrays and lists, like join or removeAll. It is complementary to the StringTools.
| Constructor Summary | |
|---|---|
ArrayUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
contains(String[] target,
String value)
Checks if the array contains the string value. |
static boolean |
contains(String[] target,
String value,
boolean caseSensitive,
boolean exact)
Checks if the array contains the string value. |
static String[] |
deleteDoubles(String[] s)
deletes all double entries from the submitted array |
static String |
join(String delimiter,
Collection<?> objects)
Joins a collection of objects with given delimiter. |
static String |
join(String delimiter,
double[] values)
Joins a list of doubles. |
static String |
join(String delimiter,
int[] values)
Joins a list of ints. |
static String |
join(String delimiter,
Object... objects)
Joins a list of objects with given delimiter. |
static String |
join(String delimiter,
String... strings)
Joins a list of strings with given delimiter. |
static String[] |
removeAll(String[] array,
String token)
Removes all occurrences of token in array |
static double[] |
splitAsDoubles(String str,
String delim)
|
static float[] |
splitAsFloats(String str,
String delim)
|
static ArrayList<Integer> |
splitAsIntList(String str,
String delim)
|
static String[] |
toArray(String s,
String delimiter,
boolean deleteDoubles)
parse a string and return its tokens as array |
static List<String> |
toList(String s,
String delimiter,
boolean deleteDoubles)
parse a string and return its tokens as typed List. empty fields will be removed from the list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayUtils()
| Method Detail |
|---|
public static String[] removeAll(String[] array,
String token)
array - token - the obj to remove
public static String join(String delimiter,
String... strings)
delimiter - the delimiter to put between every string.strings -
public static String join(String delimiter,
Object... objects)
delimiter - the delimiter to put between every string.objects -
public static String join(String delimiter,
Collection<?> objects)
delimiter - the delimiter to put between every string.objects -
public static String join(String delimiter,
int[] values)
ints.
delimiter - values -
public static String join(String delimiter,
double[] values)
doubles.
delimiter - values -
public static boolean contains(String[] target,
String value,
boolean caseSensitive,
boolean exact)
value.
target - array to check if it contains valuevalue - string to check if it within the arraycaseSensitive - true if the search should be case sensitiveexact - if the equals test should return true if one of the target strings contains a part of the value.
public static boolean contains(String[] target,
String value)
value. This method is case insensitive.
target - array to check if it contains valuevalue - string to check if it within the array
public static String[] toArray(String s,
String delimiter,
boolean deleteDoubles)
s - string to parsedelimiter - delimiter that marks the end of a tokendeleteDoubles - if it's true all string that are already within the resulting array will be deleted, so that there
will only be one copy of them.
public static List<String> toList(String s,
String delimiter,
boolean deleteDoubles)
s - string to parsedelimiter - delimiter that marks the end of a tokendeleteDoubles - if it's true all string that are already within the resulting array will be deleted, so that there
will only be one copy of them.
public static String[] deleteDoubles(String[] s)
s - to remove the doubles from
public static ArrayList<Integer> splitAsIntList(String str,
String delim)
str - delim -
public static double[] splitAsDoubles(String str,
String delim)
str - delim -
public static float[] splitAsFloats(String str,
String delim)
throws NumberFormatException
str - delim -
NumberFormatException - if one of the values could not be read.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||