/** * 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 {@link #newWeakInterner}. */ public static <E> Interner<E> newStrongInterner() { return newBuilder().strong().build(); }
public void testWeak_builder() { int concurrencyLevel = 42; Interner<Object> interner = Interners.newBuilder() .weak() .concurrencyLevel(concurrencyLevel) .build(); InternerImpl<Object> internerImpl = (InternerImpl<Object>) interner; assertEquals(Strength.WEAK, internerImpl.map.keyStrength()); assertEquals(concurrencyLevel, internerImpl.map.concurrencyLevel); }
/** * 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 {@link #newWeakInterner}. */ public static <E> Interner<E> newStrongInterner() { return newBuilder().strong().build(); }
/** * 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 {@link #newStrongInterner}, but is the best alternative when * the memory usage of that implementation is unacceptable. */ @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner() { return newBuilder().weak().build(); }
/** * 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 {@link #newStrongInterner}, but is the best alternative when * the memory usage of that implementation is unacceptable. */ @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner() { return newBuilder().weak().build(); }
public void testStrong_builder() { int concurrencyLevel = 42; Interner<Object> interner = Interners.newBuilder() .strong() .concurrencyLevel(concurrencyLevel) .build(); InternerImpl<Object> internerImpl = (InternerImpl<Object>) interner; assertEquals(Strength.STRONG, internerImpl.map.keyStrength()); }
/** * 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 {@link #newWeakInterner}. */ public static <E> Interner<E> newStrongInterner() { return newBuilder().strong().build(); }
/** * 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 {@link #newStrongInterner}, but is the best alternative when * the memory usage of that implementation is unacceptable. */ @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner() { return newBuilder().weak().build(); }
/** * 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 {@link #newStrongInterner}, but is the best alternative when * the memory usage of that implementation is unacceptable. */ @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner() { return newBuilder().weak().build(); }
/** * 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 {@link #newWeakInterner}. */ public static <E> Interner<E> newStrongInterner() { return newBuilder().strong().build(); }
public void testWeak_builder() { int concurrencyLevel = 42; Interner<Object> interner = Interners.newBuilder().weak().concurrencyLevel(concurrencyLevel).build(); InternerImpl<Object> internerImpl = (InternerImpl<Object>) interner; assertEquals(Strength.WEAK, internerImpl.map.keyStrength()); assertEquals(concurrencyLevel, internerImpl.map.concurrencyLevel); }
/** * 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 {@link #newStrongInterner}, but is the best alternative when * the memory usage of that implementation is unacceptable. */ @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner() { return newBuilder().weak().build(); }
/** * 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 {@link #newWeakInterner}. */ public static <E> Interner<E> newStrongInterner() { return newBuilder().strong().build(); }
public void testStrong_builder() { int concurrencyLevel = 42; Interner<Object> interner = Interners.newBuilder().strong().concurrencyLevel(concurrencyLevel).build(); InternerImpl<Object> internerImpl = (InternerImpl<Object>) interner; assertEquals(Strength.STRONG, internerImpl.map.keyStrength()); }