|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.multicorebsp.util.CollectionUtils
public class CollectionUtils
Supports various operations on various types of collections.
| Constructor Summary | |
|---|---|
CollectionUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
clear(java.util.Collection<T> x)
Empties a collection. |
|
static
|
contains(java.util.Collection<T> a,
java.util.Collection<T> c)
Checks if any of the elements in c are contained in a. |
|
static boolean |
contains(int[] a,
java.util.Collection<java.lang.Integer> c)
Checks if any of the elements in c are contained in a. |
|
static boolean |
contains(int[] i,
int add_1)
Checks if an element is contained in a collection. |
|
static
|
contains(T[] a,
java.util.Collection<T> c)
Checks if any of the elements in c are contained in a. |
|
static double[] |
copy(double[] original)
Copies a vector of doubles. |
|
static
|
copyCollection(java.util.Collection<T> toCopy)
Copies elements from one collection into a new one. |
|
static double[] |
copyCollection(double[] toCopy)
Copies elements from one collection into a new one. |
|
static int[] |
copyCollection(int[] toCopy)
Copies elements from one collection into a new one. |
|
static
|
copyCollection(T[] toCopy)
Copies elements from one collection into a new one. |
|
static
|
flatten(java.util.Collection<S> x)
Takes various collections of the same type and flattens them (takes consecutive unions) into a single collection. |
|
static
|
flatten(java.util.Collection<S> from,
java.util.Collection<T> into)
Takes various collections of the same type and flattens them (takes consecutive unions) into a single collection. |
|
static
|
lazyAdd(S c,
T x)
Adds an element to a collection, but does this lazily (no actual addition takes place unless necessary). |
|
static void |
printCollection(java.util.Collection<?> x)
Print a collection to screen. |
|
static void |
printCollection(java.lang.String prefix,
double[] x)
Prints a collection to screen, preceded by a given prefix. |
|
static void |
printCollection(java.lang.String prefix,
double[][] data)
Prints a collection to screen, preceded by a given prefix. |
|
static void |
printCollection(java.lang.String prefix,
int[] x)
Prints a collection to screen, preceded by a given prefix. |
|
static
|
printCollection(T[] js)
Writes a collection to file. |
|
static void |
writeCollection(java.lang.String fn,
double[] data)
Writes a collection to file. |
|
static void |
writeCollection(java.lang.String fn,
double[][] data)
Writes a collection to file. |
|
static void |
writeCollection(java.lang.String fn,
int[] js)
Writes a collection to file. |
|
static void |
writeCollection(java.lang.String fn,
java.lang.Iterable<?> x)
Writes a collection to file. |
|
static
|
writeCollection(java.lang.String fn,
T[] js)
Writes a collection to file. |
|
| 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 <T,S extends java.util.Collection<T>> java.util.Collection<T> flatten(java.util.Collection<S> x)
T - The type of elements stored in the collectionS - The type of collections to concatenatex - The various collections to be flattened
public static <T,S extends java.util.Collection<T>> void flatten(java.util.Collection<S> from,
java.util.Collection<T> into)
T - The type of elements stored in the collectionS - The type of collections to concatenatefrom - The various collections to be flattenedinto - Where to store the flattened collection
(while keeping the elements already there)public static <T> void clear(java.util.Collection<T> x)
T - The type of elements in the collectionx - The collection to clearpublic static void printCollection(java.util.Collection<?> x)
x - The collection to printpublic static <T> void printCollection(T[] js)
T - What type of elements to writejs - Which elements to print
public static void printCollection(java.lang.String prefix,
double[] x)
prefix - What to print to screen firstx - The elements to be printed to screen, after
the prefix
public static void printCollection(java.lang.String prefix,
int[] x)
prefix - What to print to screen firstx - The elements to be printed to screen, after
the prefix
public static void printCollection(java.lang.String prefix,
double[][] data)
prefix - What to print to screen firstdata - The elements to be printed to screen, after
the prefix
public static void writeCollection(java.lang.String fn,
int[] js)
fn - Which file to output tojs - Which elements to write to file
public static <T> void writeCollection(java.lang.String fn,
T[] js)
T - What type of elements to write.fn - Which file to output tojs - Which elements to write to file
public static void writeCollection(java.lang.String fn,
java.lang.Iterable<?> x)
fn - Which file to output tox - Collection of elements to write to file
public static void writeCollection(java.lang.String fn,
double[] data)
fn - Which file to output todata - Which elements to write to file
public static void writeCollection(java.lang.String fn,
double[][] data)
fn - Which file to output todata - Which elements to write to filepublic static <T extends com.multicorebsp.core.CompulsaryCloneable<? extends T>> java.util.Collection<T> copyCollection(java.util.Collection<T> toCopy)
T - The type stored in the collections.toCopy - The collection to copy.
CompulsaryCloneablepublic static <T extends com.multicorebsp.core.CompulsaryCloneable<? extends T>> java.util.Collection<T> copyCollection(T[] toCopy)
T - The type stored in the collections.toCopy - The collection to copy.
CompulsaryCloneablepublic static int[] copyCollection(int[] toCopy)
toCopy - The collection to copy.
public static double[] copyCollection(double[] toCopy)
toCopy - The collection to copy.
public static <T,S extends java.util.Collection<T>> java.util.Collection<T> lazyAdd(S c,
T x)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
T - The type of elements storedS - The type of collections usedc - The collection to add tox - The element to add
java.lang.InstantiationException
java.lang.IllegalAccessException
public static <T> boolean contains(java.util.Collection<T> a,
java.util.Collection<T> c)
T - The type of elements useda - The collection to checkc - The collection for which to be checked
public static <T> boolean contains(T[] a,
java.util.Collection<T> c)
T - The type of elements useda - The collection to checkc - The collection for which to be checked
public static boolean contains(int[] a,
java.util.Collection<java.lang.Integer> c)
a - The collection to checkc - The collection for which to be checked
public static boolean contains(int[] i,
int add_1)
i - Collection to checkadd_1 - Value to check for
public static double[] copy(double[] original)
original - The vector to copy
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||