com.rubecula.util
Class AlphabeticalMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--com.rubecula.util.AlphabeticalMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable
Direct Known Subclasses:
AttrMap

public class AlphabeticalMap
extends java.util.HashMap

Class to define an alphabetical map, that is to say a Map where the keys are case-insensitive Strings.

Since:
V_0_3
Version:
$Revision: 1.2 $
Author:
Robin Hillyard
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
AlphabeticalMap()
           
 
Method Summary
 boolean contains(java.lang.String key)
          Method to determine if this map contains entry for key (key is case-insensitive).
 java.lang.Object get(java.lang.String key)
          Method to get the entry for key (key is case-insensitive).
 AlphabeticalMap merge(AlphabeticalMap other)
          Method to merge this AttrMap with other such that the attributes in this take precedence.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Method to add an entry to the map.
 java.lang.String toString()
          Yield a string representation of this MapUtils.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

AlphabeticalMap

public AlphabeticalMap()
Method Detail

get

public java.lang.Object get(java.lang.String key)
Method to get the entry for key (key is case-insensitive).

Parameters:
key - the key to the entry being sought.
Returns:
true if map contains the attribute defined by key.

contains

public boolean contains(java.lang.String key)
Method to determine if this map contains entry for key (key is case-insensitive).

Parameters:
key - the attribute being sought.
Returns:
true if map contains the attribute defined by key.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

Method to add an entry to the map.

Note that this method has to be declared thus (not with key as a String) if it is to be called in place of the superclass method. Polymorphism seems to work that way.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap
Parameters:
key - the key (a String) to the entry being added (key is case-insensitive).
value - either null (for the default) or the entry's value as a String.
Returns:
true if map contains the entry defined by key.

merge

public AlphabeticalMap merge(AlphabeticalMap other)
Method to merge this AttrMap with other such that the attributes in this take precedence.

Parameters:
other - the subservient attribute map to be merge into this.
Returns:
the merged attribute map.

toString

public java.lang.String toString()
Yield a string representation of this MapUtils.

Overrides:
toString in class java.util.AbstractMap
Returns:
a String in the form: {attribute,attribute,...,attribute} where attribute is of form: name[=value] (where the [=value] is optional).