Package io.jawk.jrt
Class HashAssocArray
- All Implemented Interfaces:
AssocArray,Serializable,Cloneable,Map<Object,Object>
- Direct Known Subclasses:
ListAssocArray
An AWK associative array backed by a
HashMap.
Keys are not kept in any particular order. This is the default implementation used when sorted keys are not required.
- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value to which the specified key is mapped, normalizing the key first.Returns the specification version of the underlyingHashMapclass.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.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCodeMethods inherited from interface io.jawk.jrt.AssocArray
isIn, mapString, putMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
HashAssocArray
public HashAssocArray()
-
-
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 underlyingHashMapclass.- 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
-