public final class Pair<A,B> extends Object implements Comparable<Pair<A,B>>, Serializable
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Pair<A,B> other)
Defines an ordering on pairs that sorts by first value's natural ordering, ascending,
and then by second value's natural ordering.
|
boolean |
equals(Object obj) |
A |
getFirst() |
B |
getSecond() |
int |
hashCode() |
static <A,B> Pair<A,B> |
of(A a,
B b) |
Pair<B,A> |
swap() |
String |
toString() |
public A getFirst()
public B getSecond()
public static <A,B> Pair<A,B> of(A a, B b)
public int compareTo(Pair<A,B> other)
compareTo
in interface Comparable<Pair<A,B>>
ClassCastException
- if types are not actually Comparable
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.