|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cip4.jdflib.util.ContainerUtil
public class ContainerUtil
class with utilities for containers, e.g. Vectors, sets etc.
also simple object utilities
| Constructor Summary | |
|---|---|
ContainerUtil()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAll(Collection<a> c1,
Collection<a> c2)
null safe addAll |
|
static int |
compare(Comparable c0,
Comparable c1)
static implementation of compare for any comparable object that gracefully handles null null is always the smallest |
|
static
|
ensureSize(int size,
Collection<a> coll)
ensure that a collection has at least size elements and fill any newly created entries with nulls |
|
static boolean |
equals(Object a,
Object b)
return true if a equals b or both are null |
|
static
|
getKeyVector(Map<a,?> m)
create a Vector of key values from a map |
|
static
|
getMatch(Collection<? extends IMatches> c,
a obj,
int iSkip)
return a matching element from a collection of IMatches |
|
static
|
getMatches(Collection<? extends IMatches> c,
a obj)
return a matching element from a collection of IMatches |
|
static boolean |
matches(IMatches a,
Object b)
return true if a matches b or both are null |
|
static
|
toHashSet(a[] l)
create a HashSet from an Array |
|
static
|
toHashSet(Enumeration<a> enumeration)
create a HashSet from an enumeration |
|
static
|
toHashSet(List<a> list)
create a HashSet from a List (Vector...) |
|
static
|
toValueVector(Map<a,b> m)
create a Vector copy of entry values from a map |
|
static
|
toValueVector(Map<a,b> m,
boolean sortByKey)
create a Vector of entry values from a map |
|
static
|
toVector(a[] array)
create a Vector from an Array, skipping null elements |
|
static
|
unify(Collection<a> c)
unify a collection while retaining the initial order (if the input collection is ordered) |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContainerUtil()
| Method Detail |
|---|
public static <a> Set<a> toHashSet(Enumeration<a> enumeration)
a - the data type of the setsenumeration - the enumeration
public static <a> Set<a> toHashSet(List<a> list)
a - the data type of the setslist - the list
public static <a> Set<a> toHashSet(a[] l)
a - datatypel - the array
public static <a> Vector<a> toVector(a[] array)
a - the typearray - the array to convert
public static <a> Collection<a> addAll(Collection<a> c1,
Collection<a> c2)
a - typec1 - first collectionc2 - second collection
public static <a> IMatches getMatch(Collection<? extends IMatches> c,
a obj,
int iSkip)
a - the data typec - the collection to searchobj - the search key for matchesiSkip - which one to grab, may be negative in which case we count -1=last, -2=second last...
public static <a> Vector<IMatches> getMatches(Collection<? extends IMatches> c,
a obj)
a - the data typec - the collection to searchobj - the search key for matches
public static <a extends Comparable<? super a>,b> Vector<b> toValueVector(Map<a,b> m,
boolean sortByKey)
a - type of the map keyb - type of the map entrym - the map to dump to an arraysortByKey - , if true, sort the entries by key
public static <a,b> Vector<b> toValueVector(Map<a,b> m)
a - data type of the map keyb - data type of the map valuem - the map to dump to an array
public static <a> Vector<a> getKeyVector(Map<a,?> m)
a - data type of the map keym - the map to dump to an array
public static boolean equals(Object a,
Object b)
a - Object to compareb - Object to compare
public static boolean matches(IMatches a,
Object b)
a - Object to compareb - Object to compare
public static int compare(Comparable c0,
Comparable c1)
c0 - c1 -
public static <a> void ensureSize(int size,
Collection<a> coll)
a - anything - needed for the castsize - coll - public static <a> Collection<a> unify(Collection<a> c)
a - the data type of the collectionc - the collection to unify
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||