cc.mallet.util
Class CollectionUtils

java.lang.Object
  extended by cc.mallet.util.CollectionUtils

public class CollectionUtils
extends java.lang.Object

* Created: Sun Jan 25 01:04:29 2004

Version:
$Id: CollectionUtils.java,v 1.1 2007/10/22 21:37:40 mccallum Exp $
Author:
Charles Sutton

Nested Class Summary
static interface CollectionUtils.Fn
           
 
Method Summary
static java.lang.Object argmax(gnu.trove.TObjectDoubleHashMap map)
          Returns the key in map that has the greatest score
static java.lang.String dumpToString(java.util.Collection c)
           
static java.lang.String dumpToString(java.util.Collection c, java.lang.String separator)
           
static java.util.Collection intersection(java.util.Collection c1, java.util.Collection c2)
          Computes a nondestructive intersection of two collections.
static java.util.Collection map(java.util.Collection c, CollectionUtils.Fn fn)
          Returns a new collection whose elements consist of the function fn.f applied to all of the elements of the given collection.
static void print(java.util.Collection c)
           
static void print(java.util.Collection c, java.lang.String separator)
           
static java.util.List sortedUnion(java.util.List args1, java.util.List args2)
           
static java.util.Collection subset(java.util.Collection c, int size, java.util.Random rand)
           
static java.util.Collection union(java.util.Collection c1, java.util.Collection c2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dumpToString

public static java.lang.String dumpToString(java.util.Collection c,
                                            java.lang.String separator)

dumpToString

public static java.lang.String dumpToString(java.util.Collection c)

print

public static void print(java.util.Collection c)

print

public static void print(java.util.Collection c,
                         java.lang.String separator)

subset

public static java.util.Collection subset(java.util.Collection c,
                                          int size,
                                          java.util.Random rand)

sortedUnion

public static java.util.List sortedUnion(java.util.List args1,
                                         java.util.List args2)

intersection

public static java.util.Collection intersection(java.util.Collection c1,
                                                java.util.Collection c2)
Computes a nondestructive intersection of two collections.


union

public static java.util.Collection union(java.util.Collection c1,
                                         java.util.Collection c2)

argmax

public static java.lang.Object argmax(gnu.trove.TObjectDoubleHashMap map)
Returns the key in map that has the greatest score


map

public static java.util.Collection map(java.util.Collection c,
                                       CollectionUtils.Fn fn)
Returns a new collection whose elements consist of the function fn.f applied to all of the elements of the given collection. The returned collection will have the same class as the input collection.