|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.CollectionUtil
public class CollectionUtil
The CollectionUtil provides methods for wrapping normal Collection objects with ObservableCollection objects, which allows a listener to register for changes to the Collection object.
Although the Collection interface is not implemented by Maps, and therefore
it seems inconsistent to place it in a CollectionUtil class, it is sticking
with the inconsistent Sun standard used in the Collections object.
| Constructor Summary | |
|---|---|
CollectionUtil()
|
|
| Method Summary | ||
|---|---|---|
static
|
a(T... params)
quickly make an array a("a", "b" , "c", "e") |
|
static Map |
addAll(Map map,
String keyValues)
quick insert some string key / values in a map and return the map itself |
|
static Collection |
appendNull(Collection c)
Add null to a collection (used for comboboxes and lists to allow clearing) |
|
static List |
asList(Object[] objects)
Easily convert an array of objects to a list of objects (which then can be casted). |
|
static int |
binaryFindInsertLocation(List list,
Object o,
Comparator comparator)
Use a binary find algorithm to determine the index where a new object should be inserted |
|
static int |
compareForNull(Object o1,
Object o2)
Do a compare for null on the two objects. |
|
static Map |
createMap(String keyValues)
quick insert some string key / values in a linear map |
|
static
|
createNewArrayListAndClearOriginal(List<T> list)
For synchronized lists: create a new collection and clear the original |
|
static
|
l(T... params)
quickly make a list l("a", "b" , "c", "e") |
|
static
|
m(Map<K,V> map,
Object... params)
quickly make a map: alternate keys and values in the parameter list m(new LinearMap |
|
static
|
m(Object... params)
quickly make a linear map m("a", "b" , "c", "e") Map |
|
static List |
observableList(List l)
Returns an observable view of the specified object. |
|
static Map |
observableMap(Map m)
Returns an observable view of the specified object. |
|
static Set |
observableSet(Set s)
Returns an observable view of the specified object. |
|
static SortedMap |
observableSortedMap(SortedMap m)
Returns an observable view of the specified object. |
|
static SortedSet |
observableSortedSet(SortedSet s)
Returns an observable view of the specified object. |
|
static Collection |
prependNull(Collection c)
Add null to a new collection (used for comboboxes and lists to allow clearing) |
|
static Map |
put(Map map,
Object key,
Object value)
quick insert some string key / values in a map and return the map itself |
|
static
|
toList(T... arr)
Produce lists of ints or Strings: List |
|
static String |
toString(Map m)
because maps may contains array, which do not toString themselves too well |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CollectionUtil()
| Method Detail |
|---|
public static List observableList(List l)
addCollectionListener() method.
l - the list for which the observable list is returned
public static Set observableSet(Set s)
addCollectionListener() method.
s - the set for which the observable set is returned
public static SortedSet observableSortedSet(SortedSet s)
addCollectionListener() method.
s - the sorted set for which the observable sorted set is returned
public static Map observableMap(Map m)
addCollectionListener() method.
m - the map for which the observable map is returned
public static SortedMap observableSortedMap(SortedMap m)
addCollectionListener() method.
m - the sorted map for which the observable sorted map is returned
public static Map addAll(Map map,
String keyValues)
public static Map put(Map map,
Object key,
Object value)
public static Map createMap(String keyValues)
public static String toString(Map m)
public static int compareForNull(Object o1,
Object o2)
public static int binaryFindInsertLocation(List list,
Object o,
Comparator comparator)
list - o - comparator -
public static Collection appendNull(Collection c)
public static Collection prependNull(Collection c)
public static List asList(Object[] objects)
object - array
public static <T> List<T> toList(T... arr)
T - arr -
public static <T> List<T> createNewArrayListAndClearOriginal(List<T> list)
T - list -
public static <T> T[] a(T... params)
public static <T> List<T> l(T... params)
public static <K,V> Map<K,V> m(Map<K,V> map,
Object... params)
public static <K,V> Map<K,V> m(Object... params)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||