|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gentlyweb.utils.CollectionsUtils
public class CollectionsUtils
Constructor Summary | |
---|---|
CollectionsUtils()
|
Method Summary | |
---|---|
static void |
addListEntriesToMap(List list,
Map map,
boolean keyIsValue)
Add all the entries in the List as keys in the specified map. |
static void |
addMapEntriesToList(Map map,
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(List objs,
Map map,
String keyAccessor,
String valueAccessor)
Given a List of objects, convert the values it contains to the passed in Map. |
static List |
convertToRows(List objs,
int rowSize)
|
static void |
getMapEntriesAsOrderedList(Map map,
List list)
Given a Map return the entries in the Map in the passed in List in order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionsUtils()
Method Detail |
---|
public static void getMapEntriesAsOrderedList(Map map, List list)
map
- The Map to use.list
- The List to fill up.public static void addMapEntriesToList(Map map, 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 List convertToRows(List objs, int rowSize)
public static void convertListToMap(List objs, Map map, String keyAccessor, String valueAccessor) throws IllegalAccessException, InvocationTargetException, 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.
IllegalAccessException
InvocationTargetException
ClassCastException
public static void addListEntriesToMap(List list, 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 "".
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |