org.apache.commons.functor.generator.util
Class EachElement

java.lang.Object
  extended by org.apache.commons.functor.generator.util.EachElement

public final class EachElement
extends Object

Generator factory for each element of a "collection".

Since:
1.0
Version:
$Revision: 1160769 $ $Date: 2011-08-23 18:11:06 +0200 (Tue, 23 Aug 2011) $
Author:
Jason Horman (jason@jhorman.org)

Constructor Summary
EachElement()
          EachElement instances should NOT be constructed in standard programming.
 
Method Summary
static
<E> Generator<E>
from(Collection<? extends E> collection)
          Get a Generator for each element of a Collection.
static
<E> Generator<E>
from(E[] array)
          Get a Generator for each element of an Object[].
static
<E> Generator<E>
from(Iterator<? extends E> iter)
          Get a Generator for each element of an Iterator.
static
<K,V> Generator<Map.Entry<K,V>>
from(Map<? extends K,? extends V> map)
          Get a Generator for each entry of a Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EachElement

public EachElement()

EachElement instances should NOT be constructed in standard programming. Instead, the methods of the class should be invoked statically.

This constructor is public to permit tools that require a JavaBean instance to operate.

Method Detail

from

public static <E> Generator<E> from(Collection<? extends E> collection)
Get a Generator for each element of a Collection.

Type Parameters:
E - the type of elements held in the input collection.
Parameters:
collection - to iterate
Returns:
Generator

from

public static <K,V> Generator<Map.Entry<K,V>> from(Map<? extends K,? extends V> map)
Get a Generator for each entry of a Map.

Type Parameters:
K - the type of keys maintained by the input map.
V - the type of mapped values in the input map.
Parameters:
map - to iterate
Returns:
Generator

from

public static <E> Generator<E> from(E[] array)
Get a Generator for each element of an Object[].

Type Parameters:
E - the type of elements held in the input array.
Parameters:
array - to iterate
Returns:
Generator

from

public static <E> Generator<E> from(Iterator<? extends E> iter)
Get a Generator for each element of an Iterator.

Type Parameters:
E - the type of elements held in the input iterator.
Parameters:
iter - to iterate
Returns:
Generator


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.