Package ptolemy.actor.gt.data
Class SequentialTwoWayHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- ptolemy.actor.gt.data.TwoWayHashMap<K,V>
-
- ptolemy.actor.gt.data.SequentialTwoWayHashMap<K,V>
-
- Type Parameters:
K
- The key type.V
- The value type.
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<K,V>
- Direct Known Subclasses:
MatchResult
public class SequentialTwoWayHashMap<K,V> extends TwoWayHashMap<K,V>
A two-way hash map where the keys are sorted. The keys are sorted in the order in which they are added to this two-way hash map.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- See Also:
- Serialized Form
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
Constructor Summary
Constructors Constructor Description SequentialTwoWayHashMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear this two-way hash map.java.lang.Object
clone()
Clone this two-way hash map and return the clone.java.util.List<K>
keys()
Return a sorted list of keys.V
put(K key, V value)
Put a value into this two-way hash map and associate it with a key.V
remove(java.lang.Object key)
Remove the value associated with the given key.void
removeLast()
Remove the value associated with the last key.void
retain(int count)
Retain only the first count keys and their values, and remove the other keys and values.-
Methods inherited from class ptolemy.actor.gt.data.TwoWayHashMap
containsValue, getKey, values
-
Methods inherited from class java.util.HashMap
compute, computeIfAbsent, computeIfPresent, containsKey, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
-
-
-
-
Method Detail
-
clear
public void clear()
Clear this two-way hash map.
-
clone
public java.lang.Object clone()
Clone this two-way hash map and return the clone.- Overrides:
clone
in classTwoWayHashMap<K,V>
- Returns:
- The clone.
-
keys
public java.util.List<K> keys()
Return a sorted list of keys.- Returns:
- The list of keys.
-
put
public V put(K key, V value)
Put a value into this two-way hash map and associate it with a key.
-
remove
public V remove(java.lang.Object key)
Remove the value associated with the given key.
-
removeLast
public void removeLast()
Remove the value associated with the last key.
-
retain
public void retain(int count)
Retain only the first count keys and their values, and remove the other keys and values.- Parameters:
count
- The number of key-value pairs to be retained.
-
-