/** * 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 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()); }
/** * 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 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()); }
/** * 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(); }