public class

Pair

extends Object
implements Serializable Cloneable
java.lang.Object
   ↳ com.google.gdata.util.common.base.Pair<A, B>

Class Overview

Pair is an expedient way to combine two arbitrary objects into one. Its use is not to be preferred to creating a custom type, but it can be handy in a pinch. If your equals(Object), hashCode(), toString(), and/or clone() behavior matter to you at all, you may not want to use this (or you may at least wish to subclass).

This class may be used with the Google Web Toolkit (GWT).

Summary

Constants
long serialVersionUID
Fields
public final A first The first element of the pair.
public final B second The second element of the pair.
Public Constructors
Pair(A first, B second)
Cumbersome way to create a new pair (see of(A, B).
Public Methods
Pair<A, B> clone()
boolean equals(Object object)
A getFirst()
Optional accessor method for first.
B getSecond()
Optional accessor method for second.
int hashCode()
static <A, B> Pair<A, B> of(A first, B second)
Creates a new pair containing the given objects in order.
String toString()
This implementation returns the String representation of this pair in the form (string1, string2), where string1 and string2 are the toString() representations of the elements inside the pair.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final long serialVersionUID

Constant Value: 747826592375603043 (0x0a60d052d8237f63)

Fields

public final A first

The first element of the pair.

public final B second

The second element of the pair.

Public Constructors

public Pair (A first, B second)

Cumbersome way to create a new pair (see of(A, B).

Parameters
first
second

Public Methods

public Pair<A, B> clone ()

public boolean equals (Object object)

Parameters
object

public A getFirst ()

Optional accessor method for first.

public B getSecond ()

Optional accessor method for second.

public int hashCode ()

public static Pair<A, B> of (A first, B second)

Creates a new pair containing the given objects in order.

Parameters
first
second

public String toString ()

This implementation returns the String representation of this pair in the form (string1, string2), where string1 and string2 are the toString() representations of the elements inside the pair.