public class CollectionUtil extends Object
Constructor and Description |
---|
CollectionUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> List<List<T>> |
chunk(Collection<T> inCollection,
int inChunkSize) |
static <T> List<List<T>> |
chunkList(List<T> inList,
int inChunkSize) |
static <T> T |
getRandomListItem(List<T> inCollection) |
static boolean |
hasSingleValue(Collection inCollection)
Returns whether or not the specified Collection contains a single value.
|
static boolean |
hasValues(Collection inCollection)
Returns whether or not the specified Collection contains values.
|
static boolean |
hasValues(Map inMap)
Returns whether or not the specified Map contains values.
|
static <K,V extends Comparable<? super V>> |
sortMapByValue(Map<K,V> inMap) |
static <K,V extends Comparable<? super V>> |
sortMapByValue(Map<K,V> inMap,
SortOrder inSortOrder) |
static float |
sum(Collection<? extends Number> inCollection)
Returns the sum of the specified Collection.
|
public CollectionUtil()
public static boolean hasValues(Collection inCollection)
inCollection
- the Collection to evaluatepublic static boolean hasValues(Map inMap)
inMap
- the Map to evaluatepublic static boolean hasSingleValue(Collection inCollection)
inCollection
- the Collection to evaluatepublic static float sum(Collection<? extends Number> inCollection)
inCollection
- the Collection of numbers to sumpublic static <T> List<List<T>> chunk(Collection<T> inCollection, int inChunkSize)
public static <K,V extends Comparable<? super V>> Map<K,V> sortMapByValue(Map<K,V> inMap)
public static <K,V extends Comparable<? super V>> Map<K,V> sortMapByValue(Map<K,V> inMap, SortOrder inSortOrder)
public static <T> T getRandomListItem(List<T> inCollection)
jataylor@hairyfatguy.com