public final class DoublesPair extends Object implements org.joda.beans.ImmutableBean, Tuple, Comparable<DoublesPair>, Serializable
double elements.
This class is similar to Pair but is based on two primitive double elements.
This class is immutable and thread-safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
DoublesPair.Meta
The meta-bean for
DoublesPair. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DoublesPair other)
Compares the pair based on the first element followed by the second element.
|
ImmutableList<Object> |
elements()
Gets the elements from this pair as a list.
|
boolean |
equals(Object obj) |
double |
getFirst()
Gets the first element in this pair.
|
double |
getSecond()
Gets the second element in this pair.
|
int |
hashCode() |
static DoublesPair.Meta |
meta()
The meta-bean for
DoublesPair. |
DoublesPair.Meta |
metaBean() |
static DoublesPair |
of(double first,
double second)
Obtains an instance from two
double elements. |
static DoublesPair |
ofPair(Pair<Double,Double> pair)
Obtains an instance from a
Pair. |
static DoublesPair |
parse(String pairStr)
Parses a
DoublesPair from the standard string format. |
int |
size()
Gets the number of elements held by this pair.
|
Pair<Double,Double> |
toPair()
Converts this pair to an object-based
Pair. |
String |
toString()
Gets the pair using a standard string format.
|
public static DoublesPair of(double first, double second)
double elements.first - the first elementsecond - the second elementpublic static DoublesPair ofPair(Pair<Double,Double> pair)
Pair.pair - the pair to convertpublic static DoublesPair parse(String pairStr)
DoublesPair from the standard string format.
The standard format is '[$first, $second]'. Spaces around the values are trimmed.
pairStr - the text to parseIllegalArgumentException - if the pair cannot be parsedpublic int size()
public ImmutableList<Object> elements()
The list returns each element in the pair in order.
public Pair<Double,Double> toPair()
Pair.public int compareTo(DoublesPair other)
compareTo in interface Comparable<DoublesPair>other - the other pairpublic String toString()
The standard format is '[$first, $second]'. Spaces around the values are trimmed.
public static DoublesPair.Meta meta()
DoublesPair.public DoublesPair.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic double getFirst()
public double getSecond()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.