Package de.jungblut.datastructure
Class StackMap<K,V>
- java.lang.Object
-
- de.jungblut.datastructure.StackMap<K,V>
-
- Type Parameters:
K-V-
public final class StackMap<K,V> extends java.lang.ObjectA stack that also provides random access lookup of values. It is backed by a Deque(array deque) and a HashMap.- Author:
- thomas.jungblut
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classStackMap.StackMapEntry<KEY,VALUE>Immutable class for a Key/Value tuple.
-
Constructor Summary
Constructors Constructor Description StackMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vget(K key)HashMap access to get the value for a key.java.util.Map.Entry<K,V>peek()Retrieves the first item in the stack, but does not remove it.java.util.Map.Entry<K,V>pop()Retrieves the first item in the stack and removes it.Vput(K key, V value)Put method which puts the k/v mapping into the map and pushes the key on the stack.
-