Package com.google.common.collect
Class Interners
- java.lang.Object
- 
- com.google.common.collect.Interners
 
- 
 @GwtIncompatible public final class Interners extends java.lang.Object Contains static methods pertaining to instances ofInterner.- Since:
- 3.0
- Author:
- Kevin Bourrillion
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classInterners.InternerBuilderBuilder forInternerinstances.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> Function<E,E>asFunction(Interner<E> interner)Returns a function that delegates to theInterner.intern(E)method of the given interner.static Interners.InternerBuildernewBuilder()Returns a freshInterners.InternerBuilderinstance.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.
 
- 
- 
- 
Method Detail- 
newBuilderpublic static Interners.InternerBuilder newBuilder() Returns a freshInterners.InternerBuilderinstance.
 - 
newStrongInternerpublic 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. If this retention is acceptable, this implementation may perform better thannewWeakInterner().
 - 
newWeakInterner@GwtIncompatible("java.lang.ref.WeakReference") public 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. This most likely does not perform as well asnewStrongInterner(), but is the best alternative when the memory usage of that implementation is unacceptable.
 - 
asFunctionpublic static <E> Function<E,E> asFunction(Interner<E> interner) Returns a function that delegates to theInterner.intern(E)method of the given interner.- Since:
- 8.0
 
 
- 
 
-