|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.common.util.CollectionUtils
public class CollectionUtils
Constructor Summary | |
---|---|
CollectionUtils()
|
Method Summary | ||
---|---|---|
static List<Class<?>> |
asList(Class<?>... classes)
Null safe method for converting an untyped array of classes into a list. |
|
static List<Object> |
asList(Object... objects)
Null safe method for converting an array of objects into a list. |
|
static
|
combine(List<T> list1,
List<T> list2)
Return a new list containing all of the elements from the lists passed in |
|
static
|
combine(List<T> list1,
List<T> list2,
List<T> list3)
|
|
static
|
combine(T element,
List<T> list)
Return a combined list where required is always the first element in the list |
|
static
|
combineLists(List<List<T>> listOfLists)
Combine the list of lists into a single list |
|
static
|
combineMaps(List<Map<K,V>> listOfMaps)
Combine the list of maps into a single map |
|
static List<String> |
combineStrings(List<String> list1,
List<String> list2)
Return a new list containing all of the strings from both lists |
|
static List<String> |
combineStrings(List<String> list1,
List<String> list2,
List<String> list3)
|
|
static List<String> |
combineStrings(List<String> list1,
String string,
List<String> list2)
Return a new list containing all of the strings from both lists with string added in between the strings from both lists |
|
static List<String> |
combineStringsUniquely(List<String> list1,
List<String> list2)
Return a new list containing the unique set of strings contained in both lists |
|
static boolean |
containsAny(String s,
List<String> strings)
Return true if s contains any of the strings from strings |
|
static List<String> |
filter(Collection<String> strings,
StringFilter filter)
Remove any Strings from the collection that do not match the filter |
|
static List<String> |
filterAndSort(List<String> strings,
StringFilter filter)
Remove any Strings from the list that do not match the filter and then sort the ones that remain |
|
static String |
getCSV(List<String> strings)
|
|
static int[] |
getDivideEvenly(int number,
int howManyWays)
Return an array of int's that represents as even of a split as possible For example: passing in 100,7 returns 15, 15, 14, 14, 14, 14, 14 |
|
static List<String> |
getLines(String s)
|
|
static
|
getList(List<Boolean> includes,
List<T> list)
Return a list containing only the elements where the corresponding index in the includes list is true . |
|
protected static
|
getNewInstance(Class<T> c)
|
|
static
|
getNewList(Class<T> c,
int size)
Create a new list containing new instances of c |
|
static List<String> |
getNoneSensitiveListFromCSV(String csv)
If the CSV value evaluates to null , "null" , "none" or the empty string, return an empty list. |
|
static
|
getPreFilledList(int size,
T value)
|
|
static List<String> |
getSequencedStrings(List<String> strings)
Prefix the strings passed in with their position in the list (left padded with zero's). |
|
static List<String> |
getSequencedStrings(List<String> strings,
int initialSequenceNumber)
Prefix the strings passed in with their position in the list (left padded with zero's). |
|
static String |
getSpaceSeparatedCSV(List<String> strings)
|
|
static String |
getSpaceSeparatedString(List<?> list)
|
|
static String |
getStringWithSeparator(List<?> list,
String separator)
|
|
static List<String> |
getTrimmedListFromCSV(String csv)
|
|
static List<File> |
getUniqueFiles(List<File> files)
|
|
static List<String> |
getUniqueStrings(List<String> strings)
Return a new List containing the unique set of strings from strings |
|
static boolean |
isEmpty(Collection<?> c)
|
|
static
|
nullSafeAdd(List<T> list1,
List<T> list2)
|
|
static
|
nullSafeCombine(List<T> list1,
List<T> list2)
|
|
static List<String> |
sortedMerge(List<String> list,
String csv)
|
|
static
|
splitEvenly(List<T> elements,
int howManyWays)
Split elements evenly into separate lists divided up howManyWays |
|
static
|
toEmptyList(List<T> list)
If list==null return an empty list otherwise return list |
|
static
|
toEmptyList(T o)
If o==null return an empty list otherwise return a singleton list. |
|
static
|
toNullIfEmpty(Collection<T> c)
|
|
static
|
toNullIfEmpty(List<T> list)
|
|
static Object[] |
toObjectArray(List<Object> objects)
|
|
static String[] |
toStringArray(List<String> strings)
|
|
static
|
unmodifiableList(T... elements)
Get an unmodifiable list from the single element. |
|
static
|
unmodifiableList(T element)
Get an unmodifiable list from the single element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionUtils()
Method Detail |
---|
public static <T> List<T> unmodifiableList(T element)
public static <T> List<T> unmodifiableList(T... elements)
public static List<String> getNoneSensitiveListFromCSV(String csv)
null
, "null"
, "none"
or the empty string, return an empty list.
public static List<String> filterAndSort(List<String> strings, StringFilter filter)
public static List<String> filter(Collection<String> strings, StringFilter filter)
public static List<Object> asList(Object... objects)
public static List<Class<?>> asList(Class<?>... classes)
public static int[] getDivideEvenly(int number, int howManyWays)
numerator
- denominator
-
public static final <T> List<List<T>> splitEvenly(List<T> elements, int howManyWays)
elements
evenly into separate lists divided up howManyWays
public static final List<String> getSequencedStrings(List<String> strings, int initialSequenceNumber)
public static final List<String> getSequencedStrings(List<String> strings)
public static final List<String> getUniqueStrings(List<String> strings)
List
containing the unique set of strings from strings
public static final List<File> getUniqueFiles(List<File> files)
public static final List<String> getLines(String s)
public static final List<String> combineStringsUniquely(List<String> list1, List<String> list2)
protected static final <T> T getNewInstance(Class<T> c)
public static final <T> List<T> getNewList(Class<T> c, int size)
c
public static final <T> List<T> getList(List<Boolean> includes, List<T> list)
includes
list is true
. includes
and list
must be the same size.
public static final <T> List<T> combineLists(List<List<T>> listOfLists)
public static final <K,V> Map<K,V> combineMaps(List<Map<K,V>> listOfMaps)
public static final <T> List<T> combine(T element, List<T> list)
required
is always the first element in the list
public static final <T> List<T> toEmptyList(T o)
o==null
return an empty list otherwise return a singleton list.
public static final <T> List<T> toEmptyList(List<T> list)
list==null
return an empty list otherwise return list
public static final <T> List<T> toNullIfEmpty(List<T> list)
public static final <T> Collection<T> toNullIfEmpty(Collection<T> c)
public static final <T> List<T> getPreFilledList(int size, T value)
public static final String getSpaceSeparatedCSV(List<String> strings)
public static final String getStringWithSeparator(List<?> list, String separator)
public static final String getCSV(List<String> strings)
public static final String getSpaceSeparatedString(List<?> list)
public static final Object[] toObjectArray(List<Object> objects)
public static final String[] toStringArray(List<String> strings)
public static final boolean isEmpty(Collection<?> c)
public static final List<String> sortedMerge(List<String> list, String csv)
public static final List<String> getTrimmedListFromCSV(String csv)
public static final <T> List<T> nullSafeCombine(List<T> list1, List<T> list2)
public static final List<String> combineStrings(List<String> list1, List<String> list2, List<String> list3)
public static final List<String> combineStrings(List<String> list1, String string, List<String> list2)
public static final List<String> combineStrings(List<String> list1, List<String> list2)
public static final <T> List<T> combine(List<T> list1, List<T> list2)
public static final <T> List<T> combine(List<T> list1, List<T> list2, List<T> list3)
public static final <T> void nullSafeAdd(List<T> list1, List<T> list2)
public static final boolean containsAny(String s, List<String> strings)
true
if s
contains any of the strings from strings
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |