StringMap (Jetty :: Aggregate :: All core Jetty 7.6.8.v20121106 API)
Date: 2012-11-06

org.eclipse.jetty.util

## Class StringMap

- java.lang.Object
- - java.util.AbstractMap
  - - org.eclipse.jetty.util.StringMap

- All Implemented Interfaces:
    Externalizable, Serializable, Map

      public class StringMap
      extends AbstractMap
      implements Externalizable

  Map implementation Optimized for Strings keys.. This String Map has been optimized for mapping small sets of Strings where the most frequently accessed Strings have been put to the map first. It also has the benefit that it can look up entries by substring or sections of char and byte arrays. This can prevent many String objects from being created just to look up in the map. This map is NOT synchronized.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `__HASH_WIDTH`
    `protected HashSet` | `_entrySet`
    `protected boolean` | `_ignoreCase`
    `protected org.eclipse.jetty.util.StringMap.NullEntry` | `_nullEntry`
    `protected Object` | `_nullValue`
    `protected org.eclipse.jetty.util.StringMap.Node` | `_root`
    `protected Set` | `_umEntrySet`
    `protected int` | `_width`
    `static boolean` | `CASE_INSENSTIVE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringMap()` Constructor.
    `StringMap(boolean ignoreCase)` Constructor.
    `StringMap(boolean ignoreCase, int width)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `boolean` | `containsKey(Object key)`
    `Set` | `entrySet()`
    `Object` | `get(Object key)`
    `Object` | `get(String key)`
    `Map.Entry` | `getBestEntry(byte[] key, int offset, int maxLength)` Get a map entry by byte array key, using as much of the passed key as needed for a match.
    `Map.Entry` | `getEntry(char[] key, int offset, int length)` Get a map entry by char array key.
    `Map.Entry` | `getEntry(String key, int offset, int length)` Get a map entry by substring key.
    `int` | `getWidth()`
    `boolean` | `isEmpty()`
    `boolean` | `isIgnoreCase()`
    `Object` | `put(Object key, Object value)`
    `Object` | `put(String key, Object value)`
    `void` | `readExternal(ObjectInput in)`
    `Object` | `remove(Object key)`
    `Object` | `remove(String key)`
    `void` | `setIgnoreCase(boolean ic)` Set the ignoreCase attribute.
    `void` | `setWidth(int width)` Set the hash width.
    `int` | `size()`
    `void` | `writeExternal(ObjectOutput out)`

    - ### Methods inherited from class java.util.AbstractMap

      `clone, containsValue, equals, hashCode, keySet, putAll, toString, values`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### CASE_INSENSTIVE

          public static final boolean CASE_INSENSTIVE

      See Also:
        Constant Field Values

    - #### __HASH_WIDTH

          protected static final int __HASH_WIDTH

      See Also:
        Constant Field Values

    - #### _width

          protected int _width

    - #### _root

          protected org.eclipse.jetty.util.StringMap.Node _root

    - #### _ignoreCase

          protected boolean _ignoreCase

    - #### _nullEntry

          protected org.eclipse.jetty.util.StringMap.NullEntry _nullEntry

    - #### _nullValue

          protected Object _nullValue

    - #### _entrySet

          protected HashSet _entrySet

    - #### _umEntrySet

          protected Set _umEntrySet

  - ### Constructor Detail

    - #### StringMap

          public StringMap()

      Constructor.

    - #### StringMap

          public StringMap(boolean ignoreCase)

      Constructor.
      Parameters:
        `ignoreCase` -

    - #### StringMap

          public StringMap(boolean ignoreCase,
                   int width)

      Constructor.
      Parameters:
        `ignoreCase` -
        `width` - Width of hash tables, larger values are faster but use more memory.

  - ### Method Detail

    - #### setIgnoreCase

          public void setIgnoreCase(boolean ic)

      Set the ignoreCase attribute.
      Parameters:
        `ic` - If true, the map is case insensitive for keys.

    - #### isIgnoreCase

          public boolean isIgnoreCase()

    - #### setWidth

          public void setWidth(int width)

      Set the hash width.
      Parameters:
        `width` - Width of hash tables, larger values are faster but use more memory.

    - #### getWidth

          public int getWidth()

    - #### put

          public Object put(Object key,
                   Object value)

      Specified by:
        `put` in interface `Map`
      Overrides:
        `put` in class `AbstractMap`

    - #### put

          public Object put(String key,
                   Object value)

    - #### get

          public Object get(Object key)

      Specified by:
        `get` in interface `Map`
      Overrides:
        `get` in class `AbstractMap`

    - #### get

          public Object get(String key)

    - #### getEntry

          public Map.Entry getEntry(String key,
                           int offset,
                           int length)

      Get a map entry by substring key.
      Parameters:
        `key` - String containing the key
        `offset` - Offset of the key within the String.
        `length` - The length of the key
      Returns:
        The Map.Entry for the key or null if the key is not in the map.

    - #### getEntry

          public Map.Entry getEntry(char[] key,
                           int offset,
                           int length)

      Get a map entry by char array key.
      Parameters:
        `key` - char array containing the key
        `offset` - Offset of the key within the array.
        `length` - The length of the key
      Returns:
        The Map.Entry for the key or null if the key is not in the map.

    - #### getBestEntry

          public Map.Entry getBestEntry(byte[] key,
                               int offset,
                               int maxLength)

      Get a map entry by byte array key, using as much of the passed key as needed for a match. A simple 8859-1 byte to char mapping is assumed.
      Parameters:
        `key` - char array containing the key
        `offset` - Offset of the key within the array.
        `maxLength` - The length of the key
      Returns:
        The Map.Entry for the key or null if the key is not in the map.

    - #### remove

          public Object remove(Object key)

      Specified by:
        `remove` in interface `Map`
      Overrides:
        `remove` in class `AbstractMap`

    - #### remove

          public Object remove(String key)

    - #### entrySet

          public Set entrySet()

      Specified by:
        `entrySet` in interface `Map`
      Specified by:
        `entrySet` in class `AbstractMap`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Map`
      Overrides:
        `size` in class `AbstractMap`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Map`
      Overrides:
        `isEmpty` in class `AbstractMap`

    - #### containsKey

          public boolean containsKey(Object key)

      Specified by:
        `containsKey` in interface `Map`
      Overrides:
        `containsKey` in class `AbstractMap`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map`
      Overrides:
        `clear` in class `AbstractMap`

    - #### writeExternal

          public void writeExternal(ObjectOutput out)
                             throws IOException

      Specified by:
        `writeExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### readExternal

          public void readExternal(ObjectInput in)
                            throws IOException,
                                   ClassNotFoundException

      Specified by:
        `readExternal` in interface `Externalizable`
      Throws:
        `IOException`
        `ClassNotFoundException`

Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.