A
Map
implementation that holds a single item and is fixed size.
The single key/value pair is specified at creation. The map is fixed size so any action that would change the size is disallowed. However, the
put
or
setValue
methods can
change the value associated with the key.
If trying to remove or clear the map, an UnsupportedOperationException is thrown. If trying to put a new mapping into the map, an IllegalArgumentException is thrown. The put method will only suceed if the key specified is the same as the singleton key.
The key and value can be obtained by:
- normal Map methods and views
- the
MapIterator
, see {@link #mapIterator()} - the
KeyValue
interface (just cast - no object creation)
@author Matt Hall, John Watkinson, Stephen Colebourne
@version $Revision: 1.1 $ $Date: 2005/10/11 17:05:32 $
@since Commons Collections 3.1