org.biojava.bio.structure.align.util
Class AlignmentTools.IdentityMap<K>

java.lang.Object
  extended by java.util.AbstractMap<K,K>
      extended by org.biojava.bio.structure.align.util.AlignmentTools.IdentityMap<K>
Type Parameters:
K -
V -
All Implemented Interfaces:
Map<K,K>
Enclosing class:
AlignmentTools

public static class AlignmentTools.IdentityMap<K>
extends AbstractMap<K,K>

A Map can be viewed as a function from K to V. This class represents the identity function. Getting a value results in the value itself.

The class is a bit inconsistent when representing its contents. On the one hand, containsKey(key) is true for all objects. However, attempting to iterate through the values returns an empty set.

Author:
Spencer Bliven

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
AlignmentTools.IdentityMap()
           
 
Method Summary
 boolean containsKey(Object key)
           
 Set<Map.Entry<K,K>> entrySet()
          Always returns the empty set
 K get(Object key)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlignmentTools.IdentityMap

public AlignmentTools.IdentityMap()
Method Detail

get

public K get(Object key)
Specified by:
get in interface Map<K,K>
Overrides:
get in class AbstractMap<K,K>
Parameters:
key -
Returns:
the key
Throws:
ClassCastException - if key is not of type K

entrySet

public Set<Map.Entry<K,K>> entrySet()
Always returns the empty set

Specified by:
entrySet in interface Map<K,K>
Specified by:
entrySet in class AbstractMap<K,K>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,K>
Overrides:
containsKey in class AbstractMap<K,K>