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 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