JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Class Pair<A,B>

java.lang.Object
  extended by org.jboss.marshalling.Pair<A,B>
Type Parameters:
A - the first value type
B - the second value type
All Implemented Interfaces:
Serializable

@Externalize(value=Pair.Externalizer.class)
public final class Pair<A,B>
extends Object
implements Serializable

A serializable pair of values. There is also a specified externalizer as well, to support more efficient I/O.

See Also:
Serialized Form

Nested Class Summary
static class Pair.Externalizer
          An externalizer for Pair instances.
 
Constructor Summary
Pair(A a, B b)
          Create a new instance.
 
Method Summary
static
<A,B> Pair<A,B>
create(A a, B b)
          Create a new instance.
 boolean equals(Object other)
          Determine if this pair equals another.
 boolean equals(Pair<?,?> other)
          Determine if this pair equals another.
 A getA()
          Get the first value.
 B getB()
          Get the second value.
 int hashCode()
          Return the combined hash code of the two argument objects.
 String toString()
          Get a string representation of this pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(A a,
            B b)
Create a new instance.

Parameters:
a - the first value
b - the second value
Method Detail

getA

public A getA()
Get the first value.

Returns:
the first value

getB

public B getB()
Get the second value.

Returns:
the second value

hashCode

public int hashCode()
Return the combined hash code of the two argument objects.

Overrides:
hashCode in class Object
Returns:
the combined hash code

equals

public boolean equals(Object other)
Determine if this pair equals another. A pair is equal to another pair if both members are equal.

Overrides:
equals in class Object
Parameters:
other - the other pair
Returns:
true if they are equal, false otherwise

equals

public boolean equals(Pair<?,?> other)
Determine if this pair equals another. A pair is equal to another pair if both members are equal.

Parameters:
other - the other pair
Returns:
true if they are equal, false otherwise

toString

public String toString()
Get a string representation of this pair.

Overrides:
toString in class Object
Returns:
the string representation

create

public static <A,B> Pair<A,B> create(A a,
                                     B b)
Create a new instance.

Type Parameters:
A - the first value type
B - the second value type
Parameters:
a - the first value
b - the second value
Returns:
the new instance

JBoss Marshalling 1.3.0.CR9

Copyright © 2011 JBoss, a division of Red Hat, Inc.