org.biojava.bio.structure.align.util
Class AlignmentTools.IdentityMap<K>
java.lang.Object
java.util.AbstractMap<K,K>
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 classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class java.util.AbstractMap |
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values |
AlignmentTools.IdentityMap
public AlignmentTools.IdentityMap()
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>