Class Interners

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

@Beta @Deprecated(since="2022-12-01") public final class Interners extends Object
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
Contains static methods pertaining to instances of Interner.
Since:
3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static <E> Function<E,E>
    asFunction(Interner<E> interner)
    Deprecated.
    Returns a function that delegates to the Interner.intern(E) method of the given interner.
    static <E> Interner<E>
    Deprecated.
    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>
    Deprecated.
    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

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newStrongInterner

      public static <E> Interner<E> newStrongInterner()
      Deprecated.
      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 unlike String.intern(), using this interner does not consume memory in the permanent generation.
    • newWeakInterner

      @GwtIncompatible("java.lang.ref.WeakReference") public static <E> Interner<E> newWeakInterner()
      Deprecated.
      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 unlike String.intern(), using this interner does not consume memory in the permanent generation.
    • asFunction

      public static <E> Function<E,E> asFunction(Interner<E> interner)
      Deprecated.
      Returns a function that delegates to the Interner.intern(E) method of the given interner.
      Since:
      8.0