Package opennlp.tools.util.jvm

# Class StringInterners

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

public class StringInterners extends Object
Provides string interning utility methods. Interning mechanism can be configured via the system property `opennlp.interner.class` by specifying an implementation via its fully qualified classname. It needs to implement `StringInterner`.

If not specified by the user, the default interner is `CHMStringInterner`.

The implementation is loaded via the `ExtensionLoader`. Custom implementations must provide a public no-arg constructor and reside in an allowed package, see `ExtensionLoader.registerAllowedPackage(String)`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StringInterners()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static 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

  - ### StringInterners

    public StringInterners()

- ## Method Details

  - ### intern

    public static 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.
    Parameters:
      `sample` - string instance to be interned
    Returns:
      reference to the interned string instance