org.apache.commons.collections
Class SetUtils

java.lang.Object
  |
  +--org.apache.commons.collections.SetUtils

public class SetUtils
extends Object

Provides static utility methods and decorators for Set and SortedSet instances.

Since:
2.1
Version:
$Id: SetUtils.java,v 1.7 2002/10/13 00:38:36 scolebourne Exp $
Author:
Paul Jack, Stephen Colebourne

Method Summary
static Set predicatedSet(Set set, Predicate predicate)
          Returns a predicated set backed by the given set.
static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate)
          Returns a predicated sorted set backed by the given sorted set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

predicatedSet

public static Set predicatedSet(Set set,
                                Predicate predicate)
Returns a predicated set backed by the given set. Only objects that pass the test in the given predicate can be added to the set. It is important not to use the original set after invoking this method, as it is a backdoor for adding unvalidated objects.
Parameters:
set - the set to predicate, must not be null
predicate - the predicate for the set, must not be null
Returns:
a predicated set backed by the given set
Throws:
IllegalArgumentException - if the Set or Predicate is null

predicatedSortedSet

public static SortedSet predicatedSortedSet(SortedSet set,
                                            Predicate predicate)
Returns a predicated sorted set backed by the given sorted set. Only objects that pass the test in the given predicate can be added to the sorted set. It is important not to use the original sorted set after invoking this method, as it is a backdoor for adding unvalidated objects.
Parameters:
set - the sorted set to predicate, must not be null
predicate - the predicate for the sorted set, must not be null
Returns:
a predicated sorted set backed by the given sorted set
Throws:
IllegalArgumentException - if the Set or Predicate is null


Copyright © 2001-2002 Apache Software Foundation. Documenation generated October 21 2002.