Package io.jawk.jrt
Class SortedAssocArray
- All Implemented Interfaces:
AssocArray,Serializable,Cloneable,Map<Object,,Object> NavigableMap<Object,,Object> SortedMap<Object,Object>
An AWK associative array backed by a
TreeMap.
Keys are maintained in sorted order using AWK comparison semantics: numeric keys are compared numerically, string keys lexicographically, and mixed key types fall back to string comparison.
- Author:
- MetricsHub
- See Also:
-
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> -
Field Summary
Fields inherited from interface io.jawk.jrt.AssocArray
BLANK -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new sorted associative array using AWK key ordering. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value to which the specified key is mapped, normalizing the key first.Returns the specification version of the underlyingTreeMapclass.Associates the specified value with the specified key, normalizing the key to aLongwhen the key is a valid integer string.Removes the mapping for the specified key, trying both the original and itsLongequivalent.toString()Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, putAll, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, isEmptyMethods inherited from interface io.jawk.jrt.AssocArray
isIn, mapString, putMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
-
Constructor Details
-
SortedAssocArray
public SortedAssocArray()Creates a new sorted associative array using AWK key ordering.
-
-
Method Details
-
get
Returns the value to which the specified key is mapped, normalizing the key first. If the key does not exist, a blank (UninitializedObject) is inserted and returned, as required by AWK semantics. -
put
Associates the specified value with the specified key, normalizing the key to aLongwhen the key is a valid integer string. -
remove
Removes the mapping for the specified key, trying both the original and itsLongequivalent. -
getMapVersion
Returns the specification version of the underlyingTreeMapclass.- Specified by:
getMapVersionin interfaceAssocArray- Returns:
- the specification version string, or
nullif unavailable
-
toString
- Overrides:
toStringin classAbstractMap<Object,Object> - Throws:
AwkRuntimeException- always, to prevent accidental use ofAbstractMap.toString()in an AWK evaluation context
-