Top Fields Constructors Methods
com.github.benmanes.caffeine.cache

pack-priv final Class WeakInterner<E>

Located in compilation unit of com.github.benmanes.caffeine.cache.Interner.

extends Object
implements Interner<E>
Class Inheritance
All Implemented Interfaces
com.github.benmanes.caffeine.cache.Interner

Field Summary

Modifier and TypeField and Description
pack-priv final BoundedLocalCache<E, Boolean>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public E
intern(E
the element to add if absent
sample
)

Implements com.github.benmanes.caffeine.cache.Interner.intern.

Chooses and returns the representative instance for any collection of instances that are equal to each other.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
pack-priv final BoundedLocalCache<E, Boolean> cache

Constructor Detail

WeakInternerback to summary
pack-priv WeakInterner()

Method Detail

internback to summary
public E intern(E sample)

Implements com.github.benmanes.caffeine.cache.Interner.intern.

Doc from com.github.benmanes.caffeine.cache.Interner.intern.

Chooses and returns the representative instance for any collection of instances that are equal to each other. If two equal inputs are given to this method, both calls will return the same instance. That is, intern(a).equals(a) always holds, and intern(a) == intern(b) if and only if a.equals(b). Note that intern(a) is permitted to return one instance now and a different instance later if the original interned instance was garbage-collected.

Warning

Do not use with mutable objects.

Parameters
sample:E

the element to add if absent

Returns:E

the representative instance, possibly the sample if absent

Annotations
@Override