com.diasparsoftware.java.util
Class CollectionUtil

java.lang.Object
  extended bycom.diasparsoftware.java.util.CollectionUtil

public class CollectionUtil
extends java.lang.Object


Constructor Summary
CollectionUtil()
           
 
Method Summary
static boolean detect(java.util.Collection collection, org.apache.commons.collections.Predicate predicate)
          Allows you to detect whether any item in a collection satisfies some acceptance criterion.
static void forEachDo(java.util.Collection collection, org.apache.commons.collections.Closure closure)
          Execute the specified closure for each item in the specified collection.
static void forEachDo(java.util.Collection collection, ExceptionalClosure closure)
          The first exception stops the iteration.
static void forEachDo(java.util.Map map, ExceptionalMapEntryClosure closure)
          Execute the specified closure for each item in the specified collection.
static void forEachDo(java.util.Map map, MapEntryClosure closure)
          Execute the specified closure for each item in the specified collection.
static void forEachDoIgnoreException(java.util.Collection collection, ExceptionalClosure closure)
          Executes closure for each element in the specified collection, ignoring any thrown exceptions.
static java.lang.Object select(java.util.Set set, Selector selector)
          Selects the first object that the selector accepts, or null if the selector rejects them all.
static boolean stringCollectionContainsIgnoreCase(java.util.Collection stringCollection, java.lang.String searchString)
          Searches a collection of String s for the specified search string, but ignoring case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtil

public CollectionUtil()
Method Detail

detect

public static boolean detect(java.util.Collection collection,
                             org.apache.commons.collections.Predicate predicate)
Allows you to detect whether any item in a collection satisfies some acceptance criterion.

Parameters:
collection - The collection to search in
predicate - A predicate that should evaluate to true for the matching object.
Returns:

stringCollectionContainsIgnoreCase

public static boolean stringCollectionContainsIgnoreCase(java.util.Collection stringCollection,
                                                         java.lang.String searchString)
Searches a collection of String s for the specified search string, but ignoring case.

Parameters:
stringCollection - A collection of String s
searchString - The string to forEachDoIgnoreExceptionsearchString in here if we ignore case?"

forEachDoIgnoreException

public static void forEachDoIgnoreException(java.util.Collection collection,
                                            ExceptionalClosure closure)
Executes closure for each element in the specified collection, ignoring any thrown exceptions. This method is designed to be used by the JdbcResourceRegistry: at cleanup time, you can't recover from exceptions anyway.

Parameters:
collection -
closure -

forEachDo

public static void forEachDo(java.util.Collection collection,
                             ExceptionalClosure closure)
                      throws java.lang.Exception
The first exception stops the iteration.

Parameters:
collection -
closure -
Throws:
java.lang.Exception

forEachDo

public static void forEachDo(java.util.Collection collection,
                             org.apache.commons.collections.Closure closure)
Execute the specified closure for each item in the specified collection.

Parameters:
collection -
closure -
Throws:
java.lang.Exception

forEachDo

public static void forEachDo(java.util.Map map,
                             MapEntryClosure closure)
Execute the specified closure for each item in the specified collection.

Parameters:
closure -
Throws:
java.lang.Exception

forEachDo

public static void forEachDo(java.util.Map map,
                             ExceptionalMapEntryClosure closure)
                      throws java.lang.Exception
Execute the specified closure for each item in the specified collection.

Parameters:
closure -
Throws:
java.lang.Exception

select

public static java.lang.Object select(java.util.Set set,
                                      Selector selector)
Selects the first object that the selector accepts, or null if the selector rejects them all.

Parameters:
set -
selector -
Returns:


Copyright © 2003-2004 Diaspar Software Services, Inc.. All Rights Reserved.