![JAR search and dependency download from the Maven repository](/logo.png)
javadoc.com.google.common.collect.Interners.html Maven / Gradle / Ivy
The newest version!
Interners (Guava: Google Core Libraries for Java 11.0.1 API)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
com.google.common.collect
Class Interners
java.lang.Object
com.google.common.collect.Interners
Contains static methods pertaining to instances of Interner
.
- Since:
- 3.0
- Author:
- Kevin Bourrillion
Method Summary | ||
---|---|---|
static
|
asFunction(Interner<E> interner)
Returns a function that delegates to the Interner.intern(E) method of the given interner. |
|
static
|
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
|
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()
. Note that unlikeString.intern()
, using this interner does not consume memory in the permanent generation.
newWeakInterner
@GwtIncompatible(value="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 as
newStrongInterner()
, but is the best alternative when the memory usage of that implementation is unacceptable. Note that unlikeString.intern()
, using this interner does not consume memory in the permanent generation.
asFunction
public static <E> Function<E,E> asFunction(Interner<E> interner)
- Returns a function that delegates to the
Interner.intern(E)
method of the given interner.- Since:
- 8.0
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010-2012. All Rights Reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy