net.sf.morph.util
Class ContainerUtils

java.lang.Object
  extended by net.sf.composite.util.ContainerUtils
      extended by net.sf.morph.util.ContainerUtils

public class ContainerUtils
extends net.sf.composite.util.ContainerUtils

Utility functions for working with container-like objects such as Collections and arrays.

Since:
Mar 11, 2005
Author:
Matt Sgarlata

Constructor Summary
ContainerUtils()
           
 
Method Summary
static boolean contains(java.util.Collection collection, java.lang.Object value)
          Determines if the given collection contains the given value.
static boolean contains(java.lang.Object[] array, java.lang.Object value)
          Determines if the given array contains the given value.
static java.util.Set createOrderedSet()
          Create an ordered Set implementation based the classes available in the current environment.
static java.lang.Object[] intersection(java.util.List arrays)
          Returns the intersection of multiple arrays as an array.
static java.lang.Object[] intersection(java.util.List arrays, java.lang.Class componentType)
          Returns the intersection of multiple arrays as an array.
 
Methods inherited from class net.sf.composite.util.ContainerUtils
getElementsOfType, getElementsOfType, getIterator, hasElementOfType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainerUtils

public ContainerUtils()
Method Detail

contains

public static boolean contains(java.lang.Object[] array,
                               java.lang.Object value)
Determines if the given array contains the given value.

Parameters:
array - the array to test
value - the value to test
Returns:
true if the given array contains the given value or
false, otherwise

contains

public static boolean contains(java.util.Collection collection,
                               java.lang.Object value)
Determines if the given collection contains the given value.

Parameters:
collection - the collection to test
value - the value to test
Returns:
true if the given collection contains the given value or
false, otherwise

intersection

public static java.lang.Object[] intersection(java.util.List arrays,
                                              java.lang.Class componentType)
Returns the intersection of multiple arrays as an array. Implementation is O(n3).

Parameters:
arrays - a List of arrays
componentType - the runtime type of the returned array
Returns:
the intersection of the arrays

intersection

public static java.lang.Object[] intersection(java.util.List arrays)
Returns the intersection of multiple arrays as an array. Implementation is O(n3).

Parameters:
arrays - a List of arrays
Returns:
the intersection of the arrays

createOrderedSet

public static java.util.Set createOrderedSet()
Create an ordered Set implementation based the classes available in the current environment.

Returns:
Set


Copyright © 2004-2008.