net.spy.concurrent
Class Mapper<F,T>

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.concurrent.Mapper<F,T>

public class Mapper<F,T>
extends SpyObject

Map a collection of objects with a given transformer.


Constructor Summary
Mapper()
          Construct a Mapper backed by an in-place executor.
Mapper(java.util.concurrent.ExecutorService x)
          Construct a Mapper backed by the given executor service.
 
Method Summary
 java.util.List<T> transform(Transformer<F,T> trans, java.util.Collection<? extends F> in)
          Transform the given collection using the given transformer.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapper

public Mapper()
Construct a Mapper backed by an in-place executor.


Mapper

public Mapper(java.util.concurrent.ExecutorService x)
Construct a Mapper backed by the given executor service.

Method Detail

transform

public java.util.List<T> transform(Transformer<F,T> trans,
                                   java.util.Collection<? extends F> in)
                            throws java.lang.InterruptedException
Transform the given collection using the given transformer.

Parameters:
trans - the transformer
in - the collection to transform
Returns:
a list of transformed values in the same order in which they were iterated by the given collection
Throws:
java.lang.InterruptedException - if we're interrupted while processing


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.