@Beta @GwtIncompatible public final class Interners extends Object
Interner
.Modifier and Type | Method and Description |
---|---|
static <E> Function<E,E> |
asFunction(Interner<E> interner)
Returns a function that delegates to the
Interner.intern(E) method of the given interner. |
static <E> Interner<E> |
newStrongInterner()
Returns a new thread-safe interner which retains a strong reference to each instance it has
interned, thus preventing these instances from being garbage-collected.
|
static <E> Interner<E> |
newWeakInterner()
Returns a new thread-safe interner which retains a weak reference to each instance it has
interned, and so does not prevent these instances from being garbage-collected.
|
public static <E> Interner<E> newStrongInterner()
newWeakInterner()
.@GwtIncompatible(value="java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner()
newStrongInterner()
, but is the best alternative
when the memory usage of that implementation is unacceptable.public static <E> Function<E,E> asFunction(Interner<E> interner)
Interner.intern(E)
method of the given interner.Copyright © 2010-2016. All Rights Reserved.