|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.ontopia.utils.CollectionUtils
public class CollectionUtils
INTERNAL: Class that contains useful collection methods.
| Method Summary | ||
|---|---|---|
static
|
addAll(java.util.Collection<T> c,
T[] a)
INTERNAL: Adds all elements in the array to the collection. |
|
static
|
castList(java.util.Collection<T> c)
INTERNAL: Cast collection as list or make a new list. |
|
static
|
createConcurrentMap()
INTERNAL: Creates new concurrent java.util.Map instance. |
|
static
|
createConcurrentSet()
INTERNAL: Creates new concurrent java.util.Set instance. |
|
static
|
equalsUnorderedSet(java.util.Collection<T> coll1,
java.util.Collection<T> coll2)
INTERNAL: Compares two collections to see if they contain the same elements. |
|
static
|
filterSet(java.util.Collection<T> coll,
DeciderIF decider)
INTERNAL: Creates new Set that contains the elements from the input collection that the decider deems ok. |
|
static
|
getFirst(java.util.Collection<T> coll)
INTERNAL: Gets the first object in the collection. |
|
static
|
getFirstElement(java.util.Collection<T> coll)
INTERNAL: Gets the first object in the collection. |
|
static
|
getRandom(java.util.Collection<T> coll)
INTERNAL: Gets a random object from the collection. |
|
static
|
getSingletonCollectionOrEmptyIfNull(T o)
|
|
static
|
nextBatch(java.util.Iterator<T> iter,
int length)
EXPERIMENTAL: Iterates over up to length number of elements in the iterator and returns those elements as a Collection. |
|
static
|
nextBatch(java.util.Iterator<T> iter,
int length,
java.util.Collection<T> batch)
EXPERIMENTAL: Iterates over up to length number of elements in the iterator and adds those elements to the given collection. |
|
static
|
nextBatch(java.util.Iterator<T> iter,
T[] values)
EXPERIMENTAL: Iterates over up to values.length number of elements in the iterator and inserts those elements in the values> array. |
|
static
|
nextBatch(java.util.Iterator<T> iter,
T[] values,
int offset,
int length)
EXPERIMENTAL: Iterates over up to length number of elements in the iterator and inserts those elements in the values> array. |
|
static
|
overlaps(java.util.Collection<T> c1,
java.util.Collection<T> c2)
INTERNAL: Returns true if the two collections overlap with one or more elements. |
|
static
|
removeDuplicates(java.util.List<T> list)
INTERNAL: Removes all except the first occurrence of each element in the list. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> T getFirst(java.util.Collection<T> coll)
public static <T> T getFirstElement(java.util.Collection<T> coll)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic static <T> java.util.Collection<T> getSingletonCollectionOrEmptyIfNull(T o)
public static <T> T getRandom(java.util.Collection<T> coll)
public static <T> boolean equalsUnorderedSet(java.util.Collection<T> coll1,
java.util.Collection<T> coll2)
public static <T> java.util.List<T> nextBatch(java.util.Iterator<T> iter,
int length)
public static <T> int nextBatch(java.util.Iterator<T> iter,
int length,
java.util.Collection<T> batch)
public static <T> int nextBatch(java.util.Iterator<T> iter,
T[] values)
public static <T> int nextBatch(java.util.Iterator<T> iter,
T[] values,
int offset,
int length)
public static <T> java.util.List<T> castList(java.util.Collection<T> c)
public static <T> void addAll(java.util.Collection<T> c,
T[] a)
public static <T> boolean overlaps(java.util.Collection<T> c1,
java.util.Collection<T> c2)
public static <K,V> java.util.Map<K,V> createConcurrentMap()
public static <T> java.util.Set<T> createConcurrentSet()
public static <T> java.util.Set<T> filterSet(java.util.Collection<T> coll,
DeciderIF decider)
public static <T> java.util.List<T> removeDuplicates(java.util.List<T> list)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||