Package com.google.common.collect
Class Interners.WeakInterner<E>
- java.lang.Object
-
- com.google.common.collect.Interners.WeakInterner<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Interners.WeakInterner.Dummy
-
Field Summary
Fields Modifier and Type Field Description private MapMakerInternalMap<E,Interners.WeakInterner.Dummy,?,?>
map
-
Constructor Summary
Constructors Modifier Constructor Description private
WeakInterner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
intern(E sample)
Chooses and returns the representative instance for any of a collection of instances that are equal to each other.
-
-
-
Field Detail
-
map
private final MapMakerInternalMap<E,Interners.WeakInterner.Dummy,?,?> map
-
-
Method Detail
-
intern
public E intern(E sample)
Description copied from interface:Interner
Chooses and returns the representative instance for any of a collection of instances that are equal to each other. If two equal inputs are given to this method, both calls will return the same instance. That is,intern(a).equals(a)
always holds, andintern(a) == intern(b)
if and only ifa.equals(b)
. Note thatintern(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.
-
-