org.apache.avro.mapred
Class Pair<K,V>

java.lang.Object
  extended by org.apache.avro.mapred.Pair<K,V>
All Implemented Interfaces:
Comparable<Pair>, GenericContainer, IndexedRecord, SpecificDatumReader.SchemaConstructable

public class Pair<K,V>
extends Object
implements IndexedRecord, Comparable<Pair>, SpecificDatumReader.SchemaConstructable

A key/value pair.


Constructor Summary
Pair(ByteBuffer key, ByteBuffer value)
           
Pair(ByteBuffer key, CharSequence value)
           
Pair(ByteBuffer key, Double value)
           
Pair(ByteBuffer key, Float value)
           
Pair(ByteBuffer key, GenericContainer value)
           
Pair(ByteBuffer key, Integer value)
           
Pair(ByteBuffer key, Long value)
           
Pair(ByteBuffer key, Object value)
           
Pair(ByteBuffer key, Void value)
           
Pair(CharSequence key, ByteBuffer value)
           
Pair(CharSequence key, CharSequence value)
           
Pair(CharSequence key, Double value)
           
Pair(CharSequence key, Float value)
           
Pair(CharSequence key, GenericContainer value)
           
Pair(CharSequence key, Integer value)
           
Pair(CharSequence key, Long value)
           
Pair(CharSequence key, Object value)
           
Pair(CharSequence key, Void value)
           
Pair(Double key, ByteBuffer value)
           
Pair(Double key, CharSequence value)
           
Pair(Double key, Double value)
           
Pair(Double key, Float value)
           
Pair(Double key, GenericContainer value)
           
Pair(Double key, Integer value)
           
Pair(Double key, Long value)
           
Pair(Double key, Object value)
           
Pair(Double key, Void value)
           
Pair(Float key, ByteBuffer value)
           
Pair(Float key, CharSequence value)
           
Pair(Float key, Double value)
           
Pair(Float key, Float value)
           
Pair(Float key, GenericContainer value)
           
Pair(Float key, Integer value)
           
Pair(Float key, Long value)
           
Pair(Float key, Object value)
           
Pair(Float key, Void value)
           
Pair(GenericContainer key, ByteBuffer value)
           
Pair(GenericContainer key, CharSequence value)
           
Pair(GenericContainer key, Double value)
           
Pair(GenericContainer key, Float value)
           
Pair(GenericContainer key, GenericContainer value)
           
Pair(GenericContainer key, Integer value)
           
Pair(GenericContainer key, Long value)
           
Pair(GenericContainer key, Object value)
           
Pair(GenericContainer key, Void value)
           
Pair(Integer key, ByteBuffer value)
           
Pair(Integer key, CharSequence value)
           
Pair(Integer key, Double value)
           
Pair(Integer key, Float value)
           
Pair(Integer key, GenericContainer value)
           
Pair(Integer key, Integer value)
           
Pair(Integer key, Long value)
           
Pair(Integer key, Object value)
           
Pair(Integer key, Void value)
           
Pair(K key, Schema keySchema, V value, Schema valueSchema)
           
Pair(Long key, ByteBuffer value)
           
Pair(Long key, CharSequence value)
           
Pair(Long key, Double value)
           
Pair(Long key, Float value)
           
Pair(Long key, GenericContainer value)
           
Pair(Long key, Integer value)
           
Pair(Long key, Long value)
           
Pair(Long key, Object value)
           
Pair(Long key, Void value)
           
Pair(Object key, ByteBuffer value)
           
Pair(Object key, CharSequence value)
           
Pair(Object key, Double value)
           
Pair(Object key, Float value)
           
Pair(Object key, GenericContainer value)
           
Pair(Object key, Integer value)
           
Pair(Object key, Long value)
           
Pair(Object key, Object value)
           
Pair(Object key, Void value)
           
Pair(Schema schema)
           
Pair(Void key, ByteBuffer value)
           
Pair(Void key, CharSequence value)
           
Pair(Void key, Double value)
           
Pair(Void key, Float value)
           
Pair(Void key, GenericContainer value)
           
Pair(Void key, Integer value)
           
Pair(Void key, Long value)
           
Pair(Void key, Object value)
           
Pair(Void key, Void value)
           
 
Method Summary
 int compareTo(Pair that)
           
 boolean equals(Object o)
           
 Object get(int i)
          Return the value of a field given its position in the schema.
static Schema getKeySchema(Schema pair)
          Return a pair's key schema.
static Schema getPairSchema(Schema key, Schema value)
          Get a pair schema.
 Schema getSchema()
          The schema of this instance.
static Schema getValueSchema(Schema pair)
          Return a pair's value schema.
 int hashCode()
           
 K key()
          Get the key.
 void key(K key)
          Set the key.
 void put(int i, Object o)
          Set the value of a field given its position in the schema.
 void set(K key, V value)
          Set both the key and value.
 String toString()
           
 V value()
          Get the value.
 void value(V value)
          Set the value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(Schema schema)

Pair

public Pair(K key,
            Schema keySchema,
            V value,
            Schema valueSchema)

Pair

public Pair(Object key,
            Object value)

Pair

public Pair(Object key,
            GenericContainer value)

Pair

public Pair(Object key,
            CharSequence value)

Pair

public Pair(Object key,
            ByteBuffer value)

Pair

public Pair(Object key,
            Integer value)

Pair

public Pair(Object key,
            Long value)

Pair

public Pair(Object key,
            Float value)

Pair

public Pair(Object key,
            Double value)

Pair

public Pair(Object key,
            Void value)

Pair

public Pair(GenericContainer key,
            Object value)

Pair

public Pair(GenericContainer key,
            GenericContainer value)

Pair

public Pair(GenericContainer key,
            CharSequence value)

Pair

public Pair(GenericContainer key,
            ByteBuffer value)

Pair

public Pair(GenericContainer key,
            Integer value)

Pair

public Pair(GenericContainer key,
            Long value)

Pair

public Pair(GenericContainer key,
            Float value)

Pair

public Pair(GenericContainer key,
            Double value)

Pair

public Pair(GenericContainer key,
            Void value)

Pair

public Pair(CharSequence key,
            Object value)

Pair

public Pair(CharSequence key,
            GenericContainer value)

Pair

public Pair(CharSequence key,
            CharSequence value)

Pair

public Pair(CharSequence key,
            ByteBuffer value)

Pair

public Pair(CharSequence key,
            Integer value)

Pair

public Pair(CharSequence key,
            Long value)

Pair

public Pair(CharSequence key,
            Float value)

Pair

public Pair(CharSequence key,
            Double value)

Pair

public Pair(CharSequence key,
            Void value)

Pair

public Pair(ByteBuffer key,
            Object value)

Pair

public Pair(ByteBuffer key,
            GenericContainer value)

Pair

public Pair(ByteBuffer key,
            CharSequence value)

Pair

public Pair(ByteBuffer key,
            ByteBuffer value)

Pair

public Pair(ByteBuffer key,
            Integer value)

Pair

public Pair(ByteBuffer key,
            Long value)

Pair

public Pair(ByteBuffer key,
            Float value)

Pair

public Pair(ByteBuffer key,
            Double value)

Pair

public Pair(ByteBuffer key,
            Void value)

Pair

public Pair(Integer key,
            Object value)

Pair

public Pair(Integer key,
            GenericContainer value)

Pair

public Pair(Integer key,
            CharSequence value)

Pair

public Pair(Integer key,
            ByteBuffer value)

Pair

public Pair(Integer key,
            Integer value)

Pair

public Pair(Integer key,
            Long value)

Pair

public Pair(Integer key,
            Float value)

Pair

public Pair(Integer key,
            Double value)

Pair

public Pair(Integer key,
            Void value)

Pair

public Pair(Long key,
            Object value)

Pair

public Pair(Long key,
            GenericContainer value)

Pair

public Pair(Long key,
            CharSequence value)

Pair

public Pair(Long key,
            ByteBuffer value)

Pair

public Pair(Long key,
            Integer value)

Pair

public Pair(Long key,
            Long value)

Pair

public Pair(Long key,
            Float value)

Pair

public Pair(Long key,
            Double value)

Pair

public Pair(Long key,
            Void value)

Pair

public Pair(Float key,
            Object value)

Pair

public Pair(Float key,
            GenericContainer value)

Pair

public Pair(Float key,
            CharSequence value)

Pair

public Pair(Float key,
            ByteBuffer value)

Pair

public Pair(Float key,
            Integer value)

Pair

public Pair(Float key,
            Long value)

Pair

public Pair(Float key,
            Float value)

Pair

public Pair(Float key,
            Double value)

Pair

public Pair(Float key,
            Void value)

Pair

public Pair(Double key,
            Object value)

Pair

public Pair(Double key,
            GenericContainer value)

Pair

public Pair(Double key,
            CharSequence value)

Pair

public Pair(Double key,
            ByteBuffer value)

Pair

public Pair(Double key,
            Integer value)

Pair

public Pair(Double key,
            Long value)

Pair

public Pair(Double key,
            Float value)

Pair

public Pair(Double key,
            Double value)

Pair

public Pair(Double key,
            Void value)

Pair

public Pair(Void key,
            Object value)

Pair

public Pair(Void key,
            GenericContainer value)

Pair

public Pair(Void key,
            CharSequence value)

Pair

public Pair(Void key,
            ByteBuffer value)

Pair

public Pair(Void key,
            Integer value)

Pair

public Pair(Void key,
            Long value)

Pair

public Pair(Void key,
            Float value)

Pair

public Pair(Void key,
            Double value)

Pair

public Pair(Void key,
            Void value)
Method Detail

getKeySchema

public static Schema getKeySchema(Schema pair)
Return a pair's key schema.


getValueSchema

public static Schema getValueSchema(Schema pair)
Return a pair's value schema.


getPairSchema

public static Schema getPairSchema(Schema key,
                                   Schema value)
Get a pair schema.


getSchema

public Schema getSchema()
Description copied from interface: GenericContainer
The schema of this instance.

Specified by:
getSchema in interface GenericContainer

key

public K key()
Get the key.


key

public void key(K key)
Set the key.


value

public V value()
Get the value.


value

public void value(V value)
Set the value.


set

public void set(K key,
                V value)
Set both the key and value.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Pair that)
Specified by:
compareTo in interface Comparable<Pair>

toString

public String toString()
Overrides:
toString in class Object

get

public Object get(int i)
Description copied from interface: IndexedRecord
Return the value of a field given its position in the schema.

This method is not meant to be called by user code, but only by DatumWriter implementations.

Specified by:
get in interface IndexedRecord

put

public void put(int i,
                Object o)
Description copied from interface: IndexedRecord
Set the value of a field given its position in the schema.

This method is not meant to be called by user code, but only by DatumReader implementations.

Specified by:
put in interface IndexedRecord


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