A
- type AB
- type Bpublic final class ImmutablePair<A,B> extends Object
ImmutablePair
consists of two elements within. The elements once set
in the ImmutablePair cannot be modified. The class itself is final, so that it
cannot be subclassed. This is general norm for creating Immutable classes.
Please note that the ImmutablePair
cannot be modified once set, but the
objects within them can be, so in general it means that if there are mutable objects
within the pair then the pair itself is effectively mutable.
ImmutablePairtupleStreamPair= new ImmutablePair (tuple, identifier); ... ... Tuple t = tupleStreamPair.getFirst(); TupleInputStreamIdentifier identifier = tupleStreamPair.getSecond(); ...
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns whether some other object "is equal" to this object.
|
A |
getFirst()
Returns first object from pair.
|
B |
getSecond()
Return second object from pair.
|
int |
hashCode()
Returns a hash code value for this object.
|
static <A,B> ImmutablePair<A,B> |
of(A first,
B second) |
String |
toString()
Returns a string representation of
ImmutablePair object. |
public static <A,B> ImmutablePair<A,B> of(A first, B second)
public A getFirst()
public B getSecond()
public String toString()
ImmutablePair
object.public int hashCode()
Copyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.