org.millscript.commons.util.defaults
Class ConstantMapDefault<K,V>

java.lang.Object
  extended by org.millscript.commons.util.defaults.ConstantMapDefault<K,V>
All Implemented Interfaces:
IMapDefault<K,V>

public class ConstantMapDefault<K,V>
extends java.lang.Object
implements IMapDefault<K,V>

The class provides a default implementation which returns a constant value.


Constructor Summary
ConstantMapDefault(V def)
          Constructs a new constant default object which will use the specified default value.
 
Method Summary
 V get(IMap<K,V> map, K key)
          Returns the value to use when the specified key is not valid in the for the mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantMapDefault

public ConstantMapDefault(V def)
Constructs a new constant default object which will use the specified default value.

Parameters:
def - the default value
Method Detail

get

public V get(IMap<K,V> map,
             K key)
Description copied from interface: IMapDefault
Returns the value to use when the specified key is not valid in the for the mapping.

Specified by:
get in interface IMapDefault<K,V>
Parameters:
map - the map which requested the default value for the given key
key - the key that is not valid for the mapping
Returns:
the default value for when the key is not valid
See Also:
org.millscript.commons.util.IMapDefault#get(IMap, K)


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.