com.acsinet_solutions.util.adt
Class ExceptionMap<T,U>

java.lang.Object
  extended by com.acsinet_solutions.util.adt.MapDelegator<T,U>
      extended by com.acsinet_solutions.util.adt.ExceptionMap<T,U>
All Implemented Interfaces:
java.util.Map<T,U>
Direct Known Subclasses:
Catalog

public class ExceptionMap<T,U>
extends MapDelegator<T,U>

Map that throws an exception if the desired key was not found, this is useful for classes where error reporting is desired as soon as possible.

WARNING! This class is not meant to be accessed by various threads at a time as it is not thread-safe

Derechos Reservados

Author:
Santiago Arriaga

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ExceptionMap()
          Public default constructor
ExceptionMap(int initial)
          Public default constructor
ExceptionMap(java.util.Map<T,U> map)
          Public constructor
 
Method Summary
 U get(java.lang.Object key)
          Return the object associated with the given key.
 
Methods inherited from class com.acsinet_solutions.util.adt.MapDelegator
clear, containsKey, containsValue, entrySet, getCurrent, isEmpty, keySet, put, putAll, remove, setCurrent, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ExceptionMap

public ExceptionMap()
Public default constructor


ExceptionMap

public ExceptionMap(int initial)
Public default constructor


ExceptionMap

public ExceptionMap(java.util.Map<T,U> map)
Public constructor

Parameters:
map - Wrapped map structure
Method Detail

get

public final U get(java.lang.Object key)
Return the object associated with the given key. If the key was not found an unchecked exception is raised.

Specified by:
get in interface java.util.Map<T,U>
Overrides:
get in class MapDelegator<T,U>
Parameters:
key - The not-null key to the desired value
Returns:
The corresponding value to the chosen key
Throws:
java.lang.IllegalArgumentException - Thrown if the key was not found