A
- the type of the objectpublic final class ObjIntPair<A> extends Object implements ImmutableBean, Tuple, Comparable<ObjIntPair<A>>, Serializable
Object
and an int
.
This class is similar to Pair
but includes a primitive element.
This class is immutable and thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
ObjIntPair.Meta<A>
The meta-bean for
ObjIntPair . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ObjIntPair<A> 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) |
A |
getFirst()
Gets the first element in this pair.
|
int |
getSecond()
Gets the second element in this pair.
|
int |
hashCode() |
static ObjIntPair.Meta |
meta()
The meta-bean for
ObjIntPair . |
ObjIntPair.Meta<A> |
metaBean() |
static <R> ObjIntPair.Meta<R> |
metaObjIntPair(Class<R> cls)
The meta-bean for
ObjIntPair . |
static <A> ObjIntPair<A> |
of(A first,
int second)
Obtains an instance from an
Object and an int . |
static <A> ObjIntPair<A> |
ofPair(Pair<A,Integer> pair)
Obtains an instance from a
Pair . |
int |
size()
Gets the number of elements held by this pair.
|
Pair<A,Integer> |
toPair()
Converts this pair to an object-based
Pair . |
String |
toString()
Gets the pair using a standard string format.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
property, propertyNames
public static <A> ObjIntPair<A> of(A first, int second)
Object
and an int
.A
- the first element typefirst
- the first elementsecond
- the second elementpublic static <A> ObjIntPair<A> ofPair(Pair<A,Integer> pair)
Pair
.A
- the first element typepair
- the pair to convertpublic int size()
public ImmutableList<Object> elements()
The list returns each element in the pair in order.
public Pair<A,Integer> toPair()
Pair
.public int compareTo(ObjIntPair<A> other)
The first element must be Comparable
.
compareTo
in interface Comparable<ObjIntPair<A>>
other
- the other pairClassCastException
- if the object is not comparablepublic String toString()
The standard format is '[$first, $second]'. Spaces around the values are trimmed.
public static ObjIntPair.Meta meta()
ObjIntPair
.public static <R> ObjIntPair.Meta<R> metaObjIntPair(Class<R> cls)
ObjIntPair
.R
- the bean's generic typecls
- the bean's generic typepublic ObjIntPair.Meta<A> metaBean()
public A getFirst()
public int getSecond()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.