String#intern for any immutable type. Common implementations
are available from the Interners class.
Note that String.intern() has some well-known performance limitations, and should
generally be avoided. Prefer Interners#newWeakInterner or another Interner
implementation even for String interning.
| Modifier and Type | Method and Description |
|---|---|
| public E | intern(E sample)
Chooses and returns the representative instance for any of a collection of instances that are equal to each other. |
| intern | back to summary |
|---|---|
| public E intern(E sample) 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.
| |