|
||||||||||
| 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 java.util.Map |
addAll(java.util.Map map,
java.lang.String keyValues)
quick insert some string key / values in a map and return the map itself |
|
static java.util.Collection |
appendNull(java.util.Collection c)
Add null to a collection (used for comboboxes and lists to allow clearing) |
|
static java.util.List |
asList(java.lang.Object[] objects)
Easily convert an array of objects to a list of objects (which then can be casted). |
|
static int |
binaryFindInsertLocation(java.util.List list,
java.lang.Object o,
java.util.Comparator comparator)
Use a binary find algorithm to determine the index where a new object should be inserted |
|
static int |
compareForNull(java.lang.Object o1,
java.lang.Object o2)
Do a compare for null on the two objects. |
|
static java.util.Map |
createMap(java.lang.String keyValues)
quick insert some string key / values in a linear map |
|
static
|
createNewArrayListAndClearOriginal(java.util.List<T> list)
For synchronized lists: create a new collection and clear the original |
|
static java.util.List |
observableList(java.util.List l)
Returns an observable view of the specified object. |
|
static java.util.Map |
observableMap(java.util.Map m)
Returns an observable view of the specified object. |
|
static java.util.Set |
observableSet(java.util.Set s)
Returns an observable view of the specified object. |
|
static java.util.SortedMap |
observableSortedMap(java.util.SortedMap m)
Returns an observable view of the specified object. |
|
static java.util.SortedSet |
observableSortedSet(java.util.SortedSet s)
Returns an observable view of the specified object. |
|
static java.util.Collection |
prependNull(java.util.Collection c)
Add null to a new collection (used for comboboxes and lists to allow clearing) |
|
static java.util.Map |
put(java.util.Map map,
java.lang.Object key,
java.lang.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 java.lang.String |
toString(java.util.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 java.util.List observableList(java.util.List l)
addCollectionListener() method.
l - the list for which the observable list is returned
public static java.util.Set observableSet(java.util.Set s)
addCollectionListener() method.
s - the set for which the observable set is returned
public static java.util.SortedSet observableSortedSet(java.util.SortedSet s)
addCollectionListener() method.
s - the sorted set for which the observable sorted set is returned
public static java.util.Map observableMap(java.util.Map m)
addCollectionListener() method.
m - the map for which the observable map is returned
public static java.util.SortedMap observableSortedMap(java.util.SortedMap m)
addCollectionListener() method.
m - the sorted map for which the observable sorted map is returned
public static java.util.Map addAll(java.util.Map map,
java.lang.String keyValues)
public static java.util.Map put(java.util.Map map,
java.lang.Object key,
java.lang.Object value)
public static java.util.Map createMap(java.lang.String keyValues)
public static java.lang.String toString(java.util.Map m)
public static int compareForNull(java.lang.Object o1,
java.lang.Object o2)
public static int binaryFindInsertLocation(java.util.List list,
java.lang.Object o,
java.util.Comparator comparator)
list - o - comparator -
public static java.util.Collection appendNull(java.util.Collection c)
public static java.util.Collection prependNull(java.util.Collection c)
public static java.util.List asList(java.lang.Object[] objects)
object - array
public static <T> java.util.List<T> toList(T... arr)
T - arr -
public static <T> java.util.List<T> createNewArrayListAndClearOriginal(java.util.List<T> list)
T - list -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||