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

org.apache.crunch
Class Pair<K,V>

java.lang.Object
  extended by org.apache.crunch.Pair<K,V>
All Implemented Interfaces:
Serializable, Comparable<Pair<K,V>>, Tuple

public class Pair<K,V>
extends Object
implements Tuple, Comparable<Pair<K,V>>, Serializable

A convenience class for two-element Tuples.

See Also:
Serialized Form

Constructor Summary
Pair(K first, V second)
           
 
Method Summary
 int compareTo(Pair<K,V> o)
           
 boolean equals(Object obj)
           
 K first()
           
 Object get(int index)
          Returns the Object at the given index.
 int hashCode()
           
static
<T,U> Pair<T,U>
of(T first, U second)
           
 V second()
           
 int size()
          Returns the number of elements in this Tuple.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(K first,
            V second)
Method Detail

of

public static <T,U> Pair<T,U> of(T first,
                                 U second)

first

public K first()

second

public V second()

get

public Object get(int index)
Description copied from interface: Tuple
Returns the Object at the given index.

Specified by:
get in interface Tuple

size

public int size()
Description copied from interface: Tuple
Returns the number of elements in this Tuple.

Specified by:
size in interface Tuple

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Pair<K,V> o)
Specified by:
compareTo in interface Comparable<Pair<K,V>>


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