net.dontdrinkandroot.utils.collections

## Class CollectionUtils

- java.lang.Object
- - org.apache.commons.collections15.CollectionUtils
  - - net.dontdrinkandroot.utils.collections.CollectionUtils

    public class CollectionUtils
    extends org.apache.commons.collections15.CollectionUtils

### Field Summary

### Fields inherited from class org.apache.commons.collections15.CollectionUtils

`EMPTY_COLLECTION`

### Constructor Summary

Constructors
Constructor and Description
`CollectionUtils()`

### Method Summary

Methods
`static <K,V> void` `addToMapList(K key, V value, Map<K,List<V>> map)`
`static <K,V> void` `addToMapSet(K key, V value, Map<K,Set<V>> map)`
`static <T extends Number> AggregationResult` `aggregate(Collection<T> collection)`
`static <K,V extends Comparable<? super V>> SortedSet<Map.Entry<K,V>>` `entriesSortedByValues(Map<K,V> map)`
`static <K,V extends Comparable<? super V>> SortedSet<Map.Entry<K,V>>` `entriesSortedByValuesInverse(Map<K,V> map)`
`static <T> T` `first(Iterable<T> iterable)`
`static <T extends Number> double` `getMean(Collection<T> collection)`
`static <V> V` `getRandom(Collection<V> collection)`
`static boolean` `isEmpty(Object obj)` Nullsafe check if a collection is empty.

### Methods inherited from class org.apache.commons.collections15.CollectionUtils

`addAll, addAll, addAll, cardinality, collect, collect, collect, collect, containsAny, countMatches, disjunction, exists, filter, find, forAllDo, get, getCardinalityMap, index, index, intersection, isEqualCollection, isFull, isProperSubCollection, isSubCollection, main, maxSize, predicatedCollection, reverseArray, select, select, selectRejected, selectRejected, size, subtract, synchronizedCollection, transform, transformedCollection, typedCollection, union, unmodifiableCollection`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CollectionUtils

    public CollectionUtils()

### Method Detail

#### aggregate

    public static <T extends Number> AggregationResult aggregate(Collection<T> collection)

#### getMean

    public static <T extends Number> double getMean(Collection<T> collection)

#### first

    public static <T> T first(Iterable<T> iterable)

#### isEmpty

    public static boolean isEmpty(Object obj)

Nullsafe check if a collection is empty.

Parameters:
  `obj` - Null or a subclass of Collection.
Throws:
  `IllegalArgumentException` - Thrown if obj is not null and not an instance of Collection.

#### addToMapList

    public static <K,V> void addToMapList(K key,
                          V value,
                          Map<K,List<V>> map)

#### addToMapSet

    public static <K,V> void addToMapSet(K key,
                         V value,
                         Map<K,Set<V>> map)

#### getRandom

    public static <V> V getRandom(Collection<V> collection)

#### entriesSortedByValues

    public static <K,V extends Comparable<? super V>> SortedSet<Map.Entry<K,V>> entriesSortedByValues(Map<K,V> map)

#### entriesSortedByValuesInverse

    public static <K,V extends Comparable<? super V>> SortedSet<Map.Entry<K,V>> entriesSortedByValuesInverse(Map<K,V> map)