util
Class DummyMap<K,V>

java.lang.Object
  extended by util.DummyMap<K,V>
Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Implemented Interfaces:
java.util.Map<K,V>

public class DummyMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>

The DummyMap can be used to remove the space consuming behavior and retain the checking behavior of a map.
It will accept all mappings from Type K to Type V but will never store anything. Every return value is fixed to a default value:

Author:
eden06

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
DummyMap()
          Creates a new instance of DummyMap
 
Method Summary
 void clear()
          This method does nothing.
 boolean containsKey(java.lang.Object key)
          This Method does not check anything but will return false for each Object key.
 boolean containsValue(java.lang.Object value)
          This Method does not check anything but will return false for each Object value.
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
          This method will return an empty set (in fact an instance of DummySet).
 V get(java.lang.Object key)
          This method will return null for every given key.
 boolean isEmpty()
          This method will always return true, because this map will always be empty.
 java.util.Set<K> keySet()
          This method will return an empty set (in fact an instance of DummySet).
 V put(K key, V value)
          This Method does not store anything but will return null for each key, value pair.
 void putAll(java.util.Map<? extends K,? extends V> m)
          This Method does nothing.
 V remove(java.lang.Object key)
          This Method does not remove anything but will return true for each Object key.
 int size()
          This Method will always return 0 because the map is always empty.
 java.util.Collection<V> values()
          This method will return an empty set (an instance of DummySet).
 
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

DummyMap

public DummyMap()
Creates a new instance of DummyMap

Method Detail

clear

public void clear()
This method does nothing.

Specified by:
clear in interface java.util.Map<K,V>
See Also:
Map.clear()

containsKey

public final boolean containsKey(java.lang.Object key)
This Method does not check anything but will return false for each Object key.

Specified by:
containsKey in interface java.util.Map<K,V>
See Also:
Map.containsKey(java.lang.Object)

containsValue

public final boolean containsValue(java.lang.Object value)
This Method does not check anything but will return false for each Object value.

Specified by:
containsValue in interface java.util.Map<K,V>
See Also:
Map.containsValue(java.lang.Object)

entrySet

public final java.util.Set<java.util.Map.Entry<K,V>> entrySet()
This method will return an empty set (in fact an instance of DummySet).

Specified by:
entrySet in interface java.util.Map<K,V>
See Also:
Map.entrySet()

get

public final V get(java.lang.Object key)
This method will return null for every given key.

Specified by:
get in interface java.util.Map<K,V>
See Also:
Map.get(java.lang.Object)

isEmpty

public final boolean isEmpty()
This method will always return true, because this map will always be empty.

Specified by:
isEmpty in interface java.util.Map<K,V>
See Also:
Map.isEmpty()

keySet

public final java.util.Set<K> keySet()
This method will return an empty set (in fact an instance of DummySet).

Specified by:
keySet in interface java.util.Map<K,V>
See Also:
Map.keySet()

put

public final V put(K key,
                   V value)
This Method does not store anything but will return null for each key, value pair.

Specified by:
put in interface java.util.Map<K,V>
See Also:
Map.put(java.lang.Object, java.lang.Object)

putAll

public final void putAll(java.util.Map<? extends K,? extends V> m)
This Method does nothing.

Specified by:
putAll in interface java.util.Map<K,V>
See Also:
Map.putAll(java.util.Map)

remove

public final V remove(java.lang.Object key)
This Method does not remove anything but will return true for each Object key.

Specified by:
remove in interface java.util.Map<K,V>
See Also:
Map.remove(java.lang.Object)

size

public final int size()
This Method will always return 0 because the map is always empty.

Specified by:
size in interface java.util.Map<K,V>
See Also:
Map.size()

values

public final java.util.Collection<V> values()
This method will return an empty set (an instance of DummySet).

Specified by:
values in interface java.util.Map<K,V>
See Also:
Map.values()