|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujac.util.CollectionUtils
public class CollectionUtils
Name: CollectionUtils
Description: A class providing methods to ease the handling of collections.
| Constructor Summary | |
|---|---|
CollectionUtils()
|
|
| Method Summary | |
|---|---|
static void |
clear(Collection collection)
Clears the given collection. |
static void |
clear(Map map)
Clears the given map. |
static boolean |
contains(Collection collection,
Object element)
Probes whether the given map contains the given key or not. |
static boolean |
containsKey(Map map,
Object key)
Probes whether the given map contains the given key or not. |
static boolean |
containsValue(Map map,
Object value)
Probes whether the given map contains the given value or not. |
static List |
createArrayList(Object obj)
Creates an ArrayList instance and adds the given object to it. |
static List |
createArrayList(Object[] objs)
Creates an ArrayList instance and adds the given objects to it. |
static Map |
createHashMap(Object key,
Object value)
Creates a HashMap instance and adds the given key/value pair to it. |
static Set |
createHashSet(Object obj)
Creates an HashSet instance and adds the given object to it. |
static Set |
createHashSet(Object[] objs)
Creates an HashSet instance and adds the given objects to it. |
static Object |
get(Map map,
Object key)
Gets a value according to the given key from the given map. |
static int |
getSize(Collection collection)
Gets the size of the given collection. |
static int |
getSize(Map map)
Gets the size of the given map. |
static boolean |
isEmpty(Collection collection)
Probes whether the given collection is empty or not. |
static boolean |
isEmpty(Map map)
Probes whether the given map is empty or not. |
static Map |
put(Map map,
Object key,
Object value)
Puts the given key/value pair into the given map. |
static Map |
putAll(Map map,
Map other)
Puts the given key/value pair into the given map. |
static Object |
putAll(Map map,
Object key)
Gets a value according to the given key from the given map. |
static void |
sortList(List list,
CompareTuple compareTuple)
Creates an ArrayList instance and adds the given objects to it. |
static void |
sortList(List list,
CompareTuple[] compareTuples)
Creates an ArrayList instance and adds the given objects to it. |
static void |
sortList(List list,
String fieldName)
Creates an ArrayList instance and adds the given objects to it. |
static void |
sortList(List list,
String[] fieldNames)
Creates an ArrayList instance and adds the given objects to it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CollectionUtils()
| Method Detail |
|---|
public static final boolean isEmpty(Collection collection)
collection - The collection to test.
public static final int getSize(Collection collection)
collection - The collection to to get the size for.
public static final boolean contains(Collection collection,
Object element)
collection - The collection to check the presence of the element for.element - The collection to to test.
public static final void clear(Collection collection)
collection - The collection to clear.public static final boolean isEmpty(Map map)
map - The map to test.
public static final int getSize(Map map)
map - The map to to get the size for.
public static final boolean containsKey(Map map,
Object key)
map - The map to check the presence of the key for.key - The key to to test.
public static final boolean containsValue(Map map,
Object value)
map - The map to check the presence of the value for.value - The value to to test.
public static final void clear(Map map)
map - The map to clear.public static final List createArrayList(Object obj)
obj - The object to add to the List.
public static final List createArrayList(Object[] objs)
objs - The objects to add to the List.
public static final void sortList(List list,
String fieldName)
list - The list to sort.fieldName - The name of the field by which to sort.
public static final void sortList(List list,
CompareTuple compareTuple)
list - The list to sort.compareTuple - The name of the field plus the direction by which to sort.
public static final void sortList(List list,
String[] fieldNames)
list - The list to sort.fieldNames - The names of the fields by which to sort.
public static final void sortList(List list,
CompareTuple[] compareTuples)
list - The list to sort.compareTuples - The names of the field plus the directions by which to sort.public static final Set createHashSet(Object obj)
obj - The object to add to the Set.
public static final Set createHashSet(Object[] objs)
objs - The objects to add to the List.
public static final Map createHashMap(Object key,
Object value)
key - The key for the value to add.value - The value to add.
public static final Map put(Map map,
Object key,
Object value)
map - The map to set the key/value pair to.key - The key to associate the value with.value - The value to add.
public static final Map putAll(Map map,
Map other)
map - The map to add the given other map's entries to.other - The map to merge with the given map.
public static final Object get(Map map,
Object key)
map - The map to get the value from.key - The key to get the value for.
public static final Object putAll(Map map,
Object key)
map - The map to get the value from.key - The key to get the value for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||