public class MapUtils extends Object
Constructor and Description |
---|
MapUtils() |
Modifier and Type | Method and Description |
---|---|
static <T,U> void |
addToMapList(Map<T,List<U>> mapList,
T key,
U value)
An extremely common pattern: add an item to a list in a hash value, creating that list if
necessary
TODO: Replace with Guava
|
static <T,U> void |
addToMapListUnique(Map<T,List<U>> mapList,
T key,
List<U> values) |
static <T,U> void |
addToMapSet(Map<T,Set<U>> mapList,
T key,
U value)
An extremely common pattern: add an item to a set in a hash value, creating that set if
necessary
TODO: Replace with Guava
|
static <T> boolean |
addToMaxMap(Map<T,Double> map,
T key,
double value) |
static <S,T> List<T> |
mapToList(Collection<S> entities,
Function<S,T> mapper)
Map a collection of objects of type S to a list of type T using the
provided mapping function.
|
static <T,U,V extends Collection<U>> |
mergeInUnique(Map<T,V> mapList,
Map<T,V> from) |
public static final <T,U> void addToMapSet(Map<T,Set<U>> mapList, T key, U value)
public static final <T,U> void addToMapList(Map<T,List<U>> mapList, T key, U value)
public static <T,U> void addToMapListUnique(Map<T,List<U>> mapList, T key, List<U> values)
public static <T,U,V extends Collection<U>> void mergeInUnique(Map<T,V> mapList, Map<T,V> from)
public static <S,T> List<T> mapToList(Collection<S> entities, Function<S,T> mapper)
Nullsafe: if entities is null
, then null
is returned.
Copyright © 2019. All rights reserved.