de.mindcrimeilab.util
Class CollectionsHelper

java.lang.Object
  extended by de.mindcrimeilab.util.CollectionsHelper

public class CollectionsHelper
extends Object

Version:
$Revision:62 $
Author:
Michael Engelhardt, $Author:me $

Constructor Summary
CollectionsHelper()
           
 
Method Summary
static
<TIN,TOUT> void
copyCollection(Collection<TIN> source, Collection<TOUT> dest, Converter<TIN,TOUT> converter)
          Copies all items from the source collection to given collection using specified converter class.
static
<T> void
filterCollection(Collection<T> collection, Filter<? super T> filter)
          Removes all elements from the collection for which the given Filter returns true.
static
<T> void
reduceCollection(Collection<T> collection)
          Removes all duplicate items from given collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionsHelper

public CollectionsHelper()
Method Detail

filterCollection

public static <T> void filterCollection(Collection<T> collection,
                                        Filter<? super T> filter)
Removes all elements from the collection for which the given Filter returns true.

Type Parameters:
T - type specification of collection contents
Parameters:
collection - collection to be filtered
filter - instance of filter which will be evaluated for each element in the collection

reduceCollection

public static <T> void reduceCollection(Collection<T> collection)
Removes all duplicate items from given collection

Type Parameters:
T - type of items in collection
Parameters:
collection -

copyCollection

public static <TIN,TOUT> void copyCollection(Collection<TIN> source,
                                             Collection<TOUT> dest,
                                             Converter<TIN,TOUT> converter)
Copies all items from the source collection to given collection using specified converter class.

Type Parameters:
TIN - type of items in source collection
TOUT - type of items in destination collection
Parameters:
source - source collection
dest - destination collection
converter - function to convert one object into the other one


Copyright © 2010. All Rights Reserved.