This project has retired. For details please refer to its Attic page.
MapPObject (Apache Crunch 0.9.0 API)

org.apache.crunch.materialize.pobject
Class MapPObject<K,V>

java.lang.Object
  extended by org.apache.crunch.materialize.pobject.PObjectImpl<Pair<K,V>,Map<K,V>>
      extended by org.apache.crunch.materialize.pobject.MapPObject<K,V>
Type Parameters:
K - The type of keys for the Map.
V - The type of values for the Map.
All Implemented Interfaces:
PObject<Map<K,V>>

public class MapPObject<K,V>
extends PObjectImpl<Pair<K,V>,Map<K,V>>

A concrete implementation of PObjectImpl whose value is a Java Map. The underlying PCollection for this PObject must contain Pairs of values. The first element of the pair will be used as the map key, while the second element will be used as the map value. Note that the contents of the underlying PCollection may not be reflected in the returned Map, since a single key may be mapped to several values in the underlying PCollection, and only one of those values will appear in the Map encapsulated by this PObject.


Constructor Summary
MapPObject(PCollection<Pair<K,V>> collect)
          Constructs a new instance of this PObject implementation.
 
Method Summary
 Map<K,V> process(Iterable<Pair<K,V>> input)
          Transforms the provided Iterable, obtained from the backing PCollection, into the value encapsulated by this PObject.
 
Methods inherited from class org.apache.crunch.materialize.pobject.PObjectImpl
getValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapPObject

public MapPObject(PCollection<Pair<K,V>> collect)
Constructs a new instance of this PObject implementation.

Parameters:
collect - The backing PCollection for this PObject.
Method Detail

process

public Map<K,V> process(Iterable<Pair<K,V>> input)
Transforms the provided Iterable, obtained from the backing PCollection, into the value encapsulated by this PObject.

Specified by:
process in class PObjectImpl<Pair<K,V>,Map<K,V>>
Parameters:
input - An Iterable whose elements correspond to those of the backing PCollection.
Returns:
The value of this PObject.


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.