com.taco.data
Class CollectionUtilities

java.lang.Object
  extended by com.taco.data.CollectionUtilities

public class CollectionUtilities
extends java.lang.Object

A static utility class for manipulating collections.


Constructor Summary
protected CollectionUtilities()
          Since this class is not meant to be instantiated, the sole constructor is protected.
 
Method Summary
static java.util.Collection addElements(java.util.Collection c, java.util.Collection d)
          Add the elements in d to c.
static int[] toIntArray(java.util.Collection c)
          Convert the collection of instances of Number to an array of ints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtilities

protected CollectionUtilities()
Since this class is not meant to be instantiated, the sole constructor is protected.

Method Detail

toIntArray

public static final int[] toIntArray(java.util.Collection c)
Convert the collection of instances of Number to an array of ints.

Parameters:
c - A collection of instances of Number.
Returns:
A new in array of the same size of c, containing the int versions of the elements of c, in the same order.
Throws:
java.lang.NullPointerException - if c is null.
java.lang.ClassCastException - if any element in c is not an instance of Number.

addElements

public static final java.util.Collection addElements(java.util.Collection c,
                                                     java.util.Collection d)
Add the elements in d to c. Return c. This method is useful for initializing collections in field declarations.

Parameters:
c - The collection to add to and to return.
d - The collection that holds the elements to add to c.
Returns:
c
Throws:
java.lang.NullPointerException - if either c or d is null.