com.google.common.collect
Class Interners

java.lang.Object
  extended by com.google.common.collect.Interners

@Beta
public final class Interners
extends Object

Contains static methods pertaining to instances of Interner.

Since:
3
Author:
Kevin Bourrillion

Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newStrongInterner

public 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 than newWeakInterner().


newWeakInterner

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 as newStrongInterner(), but is the best alternative when the memory usage of that implementation is unacceptable.