public class CollectionsUtils
extends java.lang.Object
Constructor and Description |
---|
CollectionsUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addListEntriesToMap(java.util.List list,
java.util.Map map,
boolean keyIsValue)
Add all the entries in the List as keys in the specified map.
|
static void |
addMapEntriesToList(java.util.Map map,
java.util.List list)
Get all the entries in the Map object out and place into
the List passed in, just add at the bottom.
|
static void |
convertListToMap(java.util.List objs,
java.util.Map map,
java.lang.String keyAccessor,
java.lang.String valueAccessor)
Given a List of objects, convert the values it contains to the passed in Map.
|
static java.util.List |
convertToRows(java.util.List objs,
int rowSize) |
static void |
getMapEntriesAsOrderedList(java.util.Map map,
java.util.List list)
Given a Map return the entries in the Map in the passed in
List in order.
|
public static void getMapEntriesAsOrderedList(java.util.Map map, java.util.List list)
map
- The Map to use.list
- The List to fill up.public static void addMapEntriesToList(java.util.Map map, java.util.List list)
map
- The Map to get objects out of.list
- The List to add objects to the end of. We add the
Map.Entry.public static java.util.List convertToRows(java.util.List objs, int rowSize)
public static void convertListToMap(java.util.List objs, java.util.Map map, java.lang.String keyAccessor, java.lang.String valueAccessor) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.ClassCastException
accessors
and specify the key and value for the
map respectively. Set valueAccessor to null
to mean that
the object from the List should be added as the value. Note: all the objects
in the list MUST be of the same type, to determine the class the first object
in the list is examined.objs
- The objects to convert.map
- The Map to add the objects to.keyAccessor
- The accessor for the key to set in the map.valueAccessor
- The accessor for the value to set in the map, set to null
to get the object added.java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassCastException
public static void addListEntriesToMap(java.util.List list, java.util.Map map, boolean keyIsValue)
true
to put the entry from
the List as the value for the map as well, if it's set to
false
then we use "".list
- The List to get entries from.map
- The Map to add entries to.keyIsValue
- Indicate whether we should use the List entry
as the value as well or "".