Attributes (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.dictionary.serializer, class: Attributes

Package opennlp.tools.dictionary.serializer

# Class Attributes

java.lang.Object
opennlp.tools.dictionary.serializer.Attributes

public class Attributes extends Object
The `Attributes` class stores name value pairs.

Problem: If a `HashMap` is used storing name-value pairs this results in a very high memory footprint, replace it.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Attributes()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue(String key)`
  Retrieves the value for the given key or `null` if attribute it not set.
  `Iterator<String>`
  `iterator()`
  Iterates over the keys.
  `void`
  `setValue(String key, String value)`
  Sets a key/value pair.

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

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

- ## Constructor Details

  - ### Attributes

    public Attributes()

- ## Method Details

  - ### getValue

    public String getValue(String key)
    Retrieves the value for the given key or `null` if attribute it not set.
    Parameters:
      `key` - The key to get the desired value for.
    Returns:
      The value for the given key or `null`

  - ### setValue

    public void setValue(String key, String value)
    Sets a key/value pair.
    Parameters:
      `key` - The key that uniquely identifies the specified `value`. Must not be `null`.
      `value` - The value that shall be retrievable via its `key`. Must not be `null`.

  - ### iterator

    public Iterator<String> iterator()
    Iterates over the keys.
    Returns:
      Retrieves a key-based `Iterator`.