Class AlignmentTools.IdentityMap<K>
- java.lang.Object
-
- java.util.AbstractMap<K,K>
-
- org.biojava.nbio.structure.align.util.AlignmentTools.IdentityMap<K>
-
- Type Parameters:
K
-
- All Implemented Interfaces:
Map<K,K>
- Enclosing class:
- AlignmentTools
public static class AlignmentTools.IdentityMap<K> extends AbstractMap<K,K>
A Mapcan 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 extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description IdentityMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(Object key)
Set<Map.Entry<K,K>>
entrySet()
Always returns the empty setK
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
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
IdentityMap
public IdentityMap()
-
-
Method Detail
-
get
public K get(Object key)
- Specified by:
get
in interfaceMap<K,K>
- Overrides:
get
in classAbstractMap<K,K>
- Parameters:
key
-- Returns:
- the key
- Throws:
ClassCastException
- if key is not of type K
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<K,K>
- Overrides:
containsKey
in classAbstractMap<K,K>
-
-