Package opennlp.tools.util.jvm

# Class HMStringInterner

java.lang.Object
opennlp.tools.util.jvm.HMStringInterner

All Implemented Interfaces:
  `StringInterner`

@Internal public class HMStringInterner extends Object implements StringInterner
A `StringInterner` implementation based on `HashMap` by Aleksey Shipilëv. This implementation is not thread-safe.

Origin: https://shipilev.net/jvm/anatomy-quarks/10-string-intern/

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HMStringInterner()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `intern(String sample)`
  Interns and returns a reference to the representative instance for any collection of string instances that are equal to each other.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### HMStringInterner

    public HMStringInterner()

- ## Method Details

  - ### intern

    public String intern(String sample)
    Interns and returns a reference to the representative instance for any collection of string instances that are equal to each other.
    Specified by:
      `intern` in interface `StringInterner`
    Parameters:
      `sample` - string instance to be interned
    Returns:
      reference to the interned string instance