public class WeakIdentityPair<T1,T2>
extends java.lang.Object
Differs from Pair in the following ways: is immutable, cannot hold null, holds its
elements with weak pointers, and its equals() method uses object equality to compare its
elements.
| Constructor and Description |
|---|
WeakIdentityPair(T1 a,
T2 b)
Creates a new weakly-held pair of
a and b. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(@GuardSatisfied @Nullable java.lang.Object obj) |
T1 |
getA()
Return the first element of the pair, or null if it has been garbage-collected.
|
T2 |
getB()
Return the second element of the pair, or null if it has been garbage-collected.
|
int |
hashCode() |
static <A,B> WeakIdentityPair<A,B> |
of(A a,
B b)
Factory method with short name and no need to name type parameters.
|
java.lang.String |
toString() |
public static <A,B> WeakIdentityPair<A,B> of(A a, B b)
A - type of first argumentB - type of second argumenta - first argumentb - second argument@SideEffectFree public T1 getA(@GuardSatisfied WeakIdentityPair<T1,T2> this)
@SideEffectFree public T2 getB(@GuardSatisfied WeakIdentityPair<T1,T2> this)
@SideEffectFree public java.lang.String toString(@GuardSatisfied WeakIdentityPair<T1,T2> this)
toString in class java.lang.Object@SideEffectFree
public boolean equals(@GuardSatisfied WeakIdentityPair<T1,T2> this,
@GuardSatisfied @Nullable java.lang.Object obj)
equals in class java.lang.Object@Pure public int hashCode(@GuardSatisfied WeakIdentityPair<T1,T2> this)
hashCode in class java.lang.Object