org.sdnplatform.sync.internal.util
Class Pair<F,S>

java.lang.Object
  extended by org.sdnplatform.sync.internal.util.Pair<F,S>
All Implemented Interfaces:
com.google.common.base.Function<F,S>, java.io.Serializable, java.util.Map.Entry<F,S>
Direct Known Subclasses:
RPCService.NodeMessage

public class Pair<F,S>
extends java.lang.Object
implements java.io.Serializable, com.google.common.base.Function<F,S>, java.util.Map.Entry<F,S>

Represents a pair of items.

See Also:
Serialized Form

Constructor Summary
Pair(F first, S second)
          Use the static factory method create(Object, Object) instead of this where possible.
 
Method Summary
 S apply(F from)
           
static
<F,S> Pair<F,S>
create(F first, S second)
          Static factory method that, unlike the constructor, performs generic inference saving some typing.
 boolean equals(java.lang.Object obj)
           
 F getFirst()
           
 F getKey()
           
 S getSecond()
           
 S getValue()
           
 int hashCode()
           
 S setValue(S value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(F first,
            S second)
Use the static factory method create(Object, Object) instead of this where possible.

Parameters:
first -
second -
Method Detail

create

public static final <F,S> Pair<F,S> create(F first,
                                           S second)
Static factory method that, unlike the constructor, performs generic inference saving some typing. Use in the following way (for a pair of Strings):

Pair pair = Pair.create("first", "second");

Type Parameters:
F - The type of the first thing.
S - The type of the second thing
Parameters:
first - The first thing
second - The second thing
Returns:
The pair (first,second)

apply

public S apply(F from)
Specified by:
apply in interface com.google.common.base.Function<F,S>

getFirst

public final F getFirst()

getSecond

public final S getSecond()

hashCode

public final int hashCode()
Specified by:
hashCode in interface java.util.Map.Entry<F,S>
Overrides:
hashCode in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)
Specified by:
equals in interface com.google.common.base.Function<F,S>
Specified by:
equals in interface java.util.Map.Entry<F,S>
Overrides:
equals in class java.lang.Object

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKey

public F getKey()
Specified by:
getKey in interface java.util.Map.Entry<F,S>

getValue

public S getValue()
Specified by:
getValue in interface java.util.Map.Entry<F,S>

setValue

public S setValue(S value)
Specified by:
setValue in interface java.util.Map.Entry<F,S>