common-util

local.tomas.util.collections
Class Collections

java.lang.Object
  extended by local.tomas.util.collections.Collections

public final class Collections
extends Object

Collection utilities.

Author:
Teubner

Method Summary
static
<T,C extends Collection<T>>
C
filter(ObjectFilter filter, Collection<T> source, C target)
          Filter a collection.
static
<F,T,C extends Collection<T>>
C
map(ObjectMapping<T> mapping, Collection<F> source, C target)
          Map a collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

filter

public static <T,C extends Collection<T>> C filter(ObjectFilter filter,
                                                   Collection<T> source,
                                                   C target)
Filter a collection. All objects from a source collection which pass the filter are added to the target collection.

Type Parameters:
T - type of source collection members
C - type of target collection
Parameters:
filter - filter
source - source collection
target - target collection
Returns:
the target collection

map

public static <F,T,C extends Collection<T>> C map(ObjectMapping<T> mapping,
                                                  Collection<F> source,
                                                  C target)
Map a collection. All objects from a source collection are passed through a mapping and added to a target collection.

Type Parameters:
F - type of source collection members
T - type of mapping result
C - type of target collection
Parameters:
mapping - mapping
source - source collection
target - target collection
Returns:
the target collection

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.