se.lth.cs.nlp.nlputils.core
Class CollectionUtils

java.lang.Object
  extended by se.lth.cs.nlp.nlputils.core.CollectionUtils

public class CollectionUtils
extends Object

Some auxiliary methods for collections.

Author:
Richard Johansson (richard@cs.lth.se)

Method Summary
static
<T> void
doFilter(Collection<T> coll, Predicate<T> p)
          Destructively removes the elements for which p returns false.
static
<T> Collection<T>
filter(Collection<T> coll, Predicate<T> p)
          Returns a filtered copy of the collection coll.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doFilter

public static <T> void doFilter(Collection<T> coll,
                                Predicate<T> p)
Destructively removes the elements for which p returns false.

Parameters:
coll - the collection to modify.
p - the predicate to filter by.

filter

public static <T> Collection<T> filter(Collection<T> coll,
                                       Predicate<T> p)
Returns a filtered copy of the collection coll.

Parameters:
coll - the collection to filter.
p - the predicate to filter by.
Returns:
a new collection.