Class PriorityMap<K extends Comparable<K>, V>
java.lang.Object
kr.toxicity.model.api.util.collection.PriorityMap<K,V>
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values
A map that maintains the order of values based on priority, insertion order, and key comparison.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value to which the specified key is mapped, or null if this map contains no mapping for the key.booleanisEmpty()Returns true if this map contains no key-value mappings.Associates the specified value with the specified key and priority in this map.Removes the mapping for a key from this map if it is present.Replaces the entry for the specified key only if it is currently mapped to some value.Returns an iterator over the values in this map in priority order.
-
Constructor Details
-
PriorityMap
public PriorityMap()
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returns true if this map contains no key-value mappings.- Returns:
- true if this map contains no key-value mappings
-
put
Associates the specified value with the specified key and priority in this map.- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified keypriority- priority of the entry- Returns:
- the previous value associated with key, or null if there was no mapping for key.
-
get
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or null if this map contains no mapping for the key
-
remove
-
replace
Replaces the entry for the specified key only if it is currently mapped to some value.- Parameters:
Key- key with which the specified value is associatedfunction- the function to compute a value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key.
-
valueIterator
-