Modifier and Type | Class and Description |
---|---|
private static class |
Interners.WeakInterner.Dummy |
Modifier and Type | Field and Description |
---|---|
private MapMakerInternalMap<E,Interners.WeakInterner.Dummy,?,?> |
map |
Modifier | Constructor and Description |
---|---|
private |
WeakInterner() |
Modifier and Type | Method and Description |
---|---|
E |
intern(E sample)
Chooses and returns the representative instance for any of a collection of
instances that are equal to each other.
|
private final MapMakerInternalMap<E,Interners.WeakInterner.Dummy,?,?> map
public E intern(E sample)
Interner
intern(a).equals(a)
always holds, and intern(a) == intern(b)
if and only if a.equals(b)
. Note that
intern(a)
is permitted to return one instance now and a different
instance later if the original interned instance was garbage-collected.
Warning: do not use with mutable objects.