Class LongDoublePair
- java.lang.Object
-
- com.opengamma.strata.collect.tuple.LongDoublePair
-
- All Implemented Interfaces:
Tuple
,Serializable
,Comparable<LongDoublePair>
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class LongDoublePair extends Object implements org.joda.beans.ImmutableBean, Tuple, Comparable<LongDoublePair>, Serializable
An immutable pair consisting of along
anddouble
.This class is similar to
Pair
but is based on two primitive elements.This class is immutable and thread-safe.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LongDoublePair.Meta
The meta-bean forLongDoublePair
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(LongDoublePair 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)
long
getFirst()
Gets the first element in this pair.double
getSecond()
Gets the second element in this pair.int
hashCode()
static LongDoublePair.Meta
meta()
The meta-bean forLongDoublePair
.LongDoublePair.Meta
metaBean()
static LongDoublePair
of(long first, double second)
Obtains an instance from along
and adouble
.static LongDoublePair
ofPair(Pair<Long,Double> pair)
Obtains an instance from aPair
.static LongDoublePair
parse(String pairStr)
Parses aLongDoublePair
from the standard string format.int
size()
Gets the number of elements held by this pair.Pair<Long,Double>
toPair()
Converts this pair to an object-basedPair
.String
toString()
Gets the pair using a standard string format.
-
-
-
Method Detail
-
of
public static LongDoublePair of(long first, double second)
Obtains an instance from along
and adouble
.- Parameters:
first
- the first elementsecond
- the second element- Returns:
- a pair formed from the two parameters
-
ofPair
public static LongDoublePair ofPair(Pair<Long,Double> pair)
Obtains an instance from aPair
.- Parameters:
pair
- the pair to convert- Returns:
- a pair formed by extracting values from the pair
-
parse
public static LongDoublePair parse(String pairStr)
Parses aLongDoublePair
from the standard string format.The standard format is '[$first, $second]'. Spaces around the values are trimmed.
- Parameters:
pairStr
- the text to parse- Returns:
- the parsed pair
- Throws:
IllegalArgumentException
- if the pair cannot be parsed
-
size
public int size()
Gets the number of elements held by this pair.
-
elements
public ImmutableList<Object> elements()
Gets the elements from this pair as a list.The list returns each element in the pair in order.
-
toPair
public Pair<Long,Double> toPair()
Converts this pair to an object-basedPair
.- Returns:
- the object-based pair
-
compareTo
public int compareTo(LongDoublePair other)
Compares the pair based on the first element followed by the second element.This compares the first elements, then the second elements.
- Specified by:
compareTo
in interfaceComparable<LongDoublePair>
- Parameters:
other
- the other pair- Returns:
- negative if this is less, zero if equal, positive if greater
-
toString
public String toString()
Gets the pair using a standard string format.The standard format is '[$first, $second]'. Spaces around the values are trimmed.
-
meta
public static LongDoublePair.Meta meta()
The meta-bean forLongDoublePair
.- Returns:
- the meta-bean, not null
-
metaBean
public LongDoublePair.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getFirst
public long getFirst()
Gets the first element in this pair.- Returns:
- the value of the property
-
getSecond
public double getSecond()
Gets the second element in this pair.- Returns:
- the value of the property
-
-