@java.lang.SuppressWarnings("unused") public class CollectionUtilities extends java.lang.Object
These are utilities that should exist elsewhere, but I can't find a good simple library for them, and they are stupid but necessary for certain things.
Modifiers | Name | Description |
---|---|---|
static class |
CollectionUtilities.KeyValue |
|
static class |
CollectionUtilities.MapOrderByComparator |
Modifiers | Name | Description |
---|---|---|
protected static org.slf4j.Logger |
logger |
|
static java.util.Collection<java.lang.Object> |
singleNullCollection |
Type Params | Return Type | Name and description |
---|---|---|
|
public static void |
addBigDecimalsInMap(java.util.Map<java.lang.String, java.lang.Object> baseMap, java.util.Map<java.lang.String, java.lang.Object> addMap) |
|
public static void |
addToBigDecimalInMap(java.lang.Object key, java.math.BigDecimal value, java.util.Map theMap) |
|
public static void |
addToListInMap(java.lang.Object key, java.lang.Object value, java.util.Map theMap) |
|
public static void |
addToMapInMap(java.lang.Object keyOuter, java.lang.Object keyInner, java.lang.Object value, java.util.Map theMap) |
|
public static boolean |
addToSetInMap(java.lang.Object key, java.lang.Object value, java.util.Map theMap) |
|
public static groovy.util.Node |
deepCopyNode(groovy.util.Node original) |
|
public static groovy.util.Node |
deepCopyNode(groovy.util.Node original, groovy.util.Node parent) |
|
public static void |
divideBigDecimalsInMap(java.util.Map<java.lang.String, java.lang.Object> baseMap, java.math.BigDecimal divisor) |
|
public static void |
filterMapList(java.util.List<java.util.Map> theList, java.util.Map<java.lang.String, java.lang.Object> fieldValues) |
|
public static void |
filterMapList(java.util.List<java.util.Map> theList, java.util.Map<java.lang.String, java.lang.Object> fieldValues, boolean exclude) Filter theList (of Map) using fieldValues; if exclude=true remove matching items, else keep only matching items |
|
public static java.util.List<java.util.Map> |
filterMapListByDate(java.util.List<java.util.Map> theList, java.lang.String fromDateName, java.lang.String thruDateName, java.sql.Timestamp compareStamp) |
|
public static void |
filterMapListByDate(java.util.List<java.util.Map> theList, java.lang.String fromDateName, java.lang.String thruDateName, java.sql.Timestamp compareStamp, boolean ignoreIfEmpty) |
|
public static void |
findAllFieldsNestedMap(java.lang.String key, java.util.Map theMap, java.util.Set<java.lang.Object> valueSet) Find all values of a named field in a nested Map containing fields, Maps, and Collections of Maps (Lists, etc) |
|
public static java.lang.Object |
findFieldNestedMap(java.lang.String key, java.util.Map theMap) Find a field value in a nested Map containing fields, Maps, and Collections of Maps (Lists, etc) |
|
public static java.util.Map<java.lang.String, java.lang.Object> |
findMaximalMatch(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> mapList, java.util.LinkedHashMap<java.lang.String, java.lang.Object> fieldsByPriority) For a list of Map find the entry that best matches the fieldsByPriority Ordered Map; null field values in a Map in mapList match against any value but do not contribute to maximal match score, otherwise value for each field in fieldsByPriority must match for it to be a candidate. |
|
public static java.util.Map |
flattenNestedMap(java.util.Map theMap) Creates a single Map with fields from the passed in Map and all nested Maps (for Map and Collection of Map entry values) |
|
public static java.util.ArrayList<java.lang.Object> |
getMapArrayListValues(java.util.ArrayList<java.util.Map<java.lang.Object, java.lang.Object>> mapList, java.lang.Object key, boolean excludeNullValues) |
|
public static boolean |
mapMatchesFields(java.util.Map<java.lang.String, java.lang.Object> baseMap, java.util.Map<java.lang.String, java.lang.Object> compareMap) |
|
public static void |
mergeNestedMap(java.util.Map<java.lang.Object, java.lang.Object> baseMap, java.util.Map<java.lang.Object, java.lang.Object> overrideMap, boolean overrideEmpty) |
|
public static groovy.util.Node |
nodeChild(groovy.util.Node parent, java.lang.String childName) |
|
public static java.lang.String |
nodeText(java.lang.Object nodeObj) |
|
public static java.util.List<java.util.Map<java.lang.String, java.lang.Object>> |
orderMapList(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> theList, java.util.List<? extends java.lang.CharSequence> fieldNames) Order list elements in place (modifies the list passed in), returns the list for convenience |
|
public static java.util.List<java.util.Map<java.lang.String, java.lang.Object>> |
orderMapList(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> theList, java.util.List<? extends java.lang.CharSequence> fieldNames, java.lang.Boolean nullsLast) |
|
public static void |
paginateList(java.lang.String listName, java.lang.String pageListName, java.util.Map<java.lang.String, java.lang.Object> context) |
|
public static java.util.List |
paginateList(java.util.List theList, java.lang.String pageListName, java.util.Map<java.lang.String, java.lang.Object> context) |
|
public static java.util.Map |
paginateParameters(int listSize, java.lang.String pageListName, java.util.Map<java.lang.String, java.lang.Object> context) |
|
public static java.util.Map |
removeNullsFromMap(java.util.Map theMap) Removes entries with a null value from the Map, returns the passed in Map for convenience (does not clone before removes!). |
|
public static java.util.Map<java.lang.String, java.math.BigDecimal> |
stdDevMaxFromMapField(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> dataList, java.lang.String fieldName, java.math.BigDecimal stdDevMultiplier) Returns Map with total, squaredTotal, count, average, stdDev, maximum; fieldName field in Maps must have type BigDecimal; if count of non-null fields is less than 2 returns null as cannot calculate a standard deviation |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Filter theList (of Map) using fieldValues; if exclude=true remove matching items, else keep only matching items
Find all values of a named field in a nested Map containing fields, Maps, and Collections of Maps (Lists, etc)
Find a field value in a nested Map containing fields, Maps, and Collections of Maps (Lists, etc)
For a list of Map find the entry that best matches the fieldsByPriority Ordered Map; null field values in a Map in mapList match against any value but do not contribute to maximal match score, otherwise value for each field in fieldsByPriority must match for it to be a candidate.
Creates a single Map with fields from the passed in Map and all nested Maps (for Map and Collection of Map entry values)
Order list elements in place (modifies the list passed in), returns the list for convenience
Removes entries with a null value from the Map, returns the passed in Map for convenience (does not clone before removes!).
Returns Map with total, squaredTotal, count, average, stdDev, maximum; fieldName field in Maps must have type BigDecimal; if count of non-null fields is less than 2 returns null as cannot calculate a standard deviation