Interner.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Interners.InternerBuilder
Builder for |
| private static class | |
| pack-priv static class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <E> Function | asFunction(Interner<E> interner)
Returns a function that delegates to the |
| public static Interners. | |
| public static <E> Interner | 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. |
| public static <E> Interner | 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. |
| Interners | back to summary |
|---|---|
| private Interners() | |
| asFunction | back to summary |
|---|---|
| public static <E> Function Returns a function that delegates to the
| |
| newBuilder | back to summary |
|---|---|
| public static Interners. Returns a fresh | |
| newStrongInterner | back to summary |
|---|---|
| public static <E> Interner 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 | back to summary |
|---|---|
| public static <E> Interner 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
| |
Interner instances.
| Modifier and Type | Field and Description |
|---|---|
| private final MapMaker | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public <E> Interner | |
| public Interners. | concurrencyLevel(int concurrencyLevel)
Sets the concurrency level that will be used by the to-be-built |
| public Interners. | |
| public Interners. |
| mapMaker | back to summary |
|---|---|
| private final MapMaker mapMaker | |
| strong | back to summary |
|---|---|
| private boolean strong | |
| InternerBuilder | back to summary |
|---|---|
| private InternerBuilder() | |
| build | back to summary |
|---|---|
| public <E> Interner | |
| concurrencyLevel | back to summary |
|---|---|
| public Interners. Sets the concurrency level that will be used by the to-be-built
| |
| strong | back to summary |
|---|---|
| public Interners. Instructs the
| |
| weak | back to summary |
|---|---|
| public Interners. Instructs the
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public E | apply(E
the function argument input)Implements com. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Implements com. true if object is a Function that behaves identically
to this function.
|
| public int |
| interner | back to summary |
|---|---|
| private final Interner<E> interner | |
| InternerFunction | back to summary |
|---|---|
| public InternerFunction(Interner<E> interner) | |
| apply | back to summary |
|---|---|
| public E apply(E input) Implements com. Doc from java. Applies this function to the given argument.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Implements com. Doc from com. May return Warning: do not depend on the behavior of this method. Historically,
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final MapMakerInternalMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public E | intern(E sample)
Implements com. |
| map | back to summary |
|---|---|
| pack-priv final MapMakerInternalMap<E, MapMaker. | |
| InternerImpl | back to summary |
|---|---|
| private InternerImpl(MapMaker mapMaker) | |
| intern | back to summary |
|---|---|
| public E intern(E sample) Implements com. Doc from com. Chooses and returns the representative instance for any of a 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, Warning do not use with mutable objects.
| |