public class IntDoublePair extends Object implements Comparable<IntDoublePair>, PairInterface<Integer,Double>
CPair
generic.Modifier and Type | Field and Description |
---|---|
static Comparator<IntDoublePair> |
BYFIRST_COMPARATOR
Comparator to compare by second component only
|
static Comparator<IntDoublePair> |
BYSECOND_COMPARATOR
Comparator to compare by second component only
|
int |
first
first value
|
double |
second
second value
|
static Comparator<IntDoublePair> |
SWAPPED_COMPARATOR
Comparator to compare by swapped components
|
Constructor and Description |
---|
IntDoublePair(int first,
double second)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareSwappedTo(IntDoublePair other)
Implementation of comparableSwapped interface, sorting by second then
first.
|
int |
compareTo(IntDoublePair other)
Implementation of comparable interface, sorting by first then second.
|
boolean |
equals(Object obj)
Trivial equals implementation
|
Integer |
getFirst()
Deprecated.
use pair.first to avoid boxing!
|
Double |
getSecond()
Deprecated.
use pair.first to avoid boxing!
|
int |
hashCode()
Trivial hashCode implementation mixing the two integers.
|
void |
setFirst(int first)
Set first value
|
void |
setSecond(double second)
Set second value
|
String |
toString()
Returns first and second value.
|
public int first
public double second
public static final Comparator<IntDoublePair> BYFIRST_COMPARATOR
public static final Comparator<IntDoublePair> BYSECOND_COMPARATOR
public static final Comparator<IntDoublePair> SWAPPED_COMPARATOR
public IntDoublePair(int first, double second)
first
- First valuesecond
- Second valuepublic boolean equals(Object obj)
public final int hashCode()
public int compareTo(IntDoublePair other)
compareTo
in interface Comparable<IntDoublePair>
other
- Object to compare topublic int compareSwappedTo(IntDoublePair other)
other
- Object to compare to@Deprecated public final Integer getFirst()
PairInterface
getFirst
in interface PairInterface<Integer,Double>
public final void setFirst(int first)
first
- new value@Deprecated public final Double getSecond()
PairInterface
getSecond
in interface PairInterface<Integer,Double>
public final void setSecond(double second)
second
- new value