Top Description Fields Constructors Methods
org.antlr.v4.misc

public Class OrderedHashMap<K, V>

extends LinkedHashMap<K, V>
Class Inheritance
Imports
java.util.ArrayList, .LinkedHashMap, .List, .Map

I need the get-element-i functionality so I'm subclassing LinkedHashMap.

Field Summary

Modifier and TypeField and Description
protected List<K>
elements

Track the elements as they are added to the set

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.LinkedHashMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).
public V
getElement(int i)

public K
getKey(int i)

public V
put(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Overrides java.util.HashMap.put.

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).
public void
putAll(Map<? extends K, ? extends V>
mappings to be stored in this map
m
)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).
public V
remove(Object
key whose mapping is to be removed from the map
key
)

Overrides java.util.HashMap.remove.

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).
Inherited from java.util.LinkedHashMap:
containsValueentrySetforEachgetgetOrDefaultkeySetnewLinkedHashMapputFirstputLastremoveEldestEntryreplaceAllreversedsequencedEntrySetsequencedKeySetsequencedValuesvalues

Field Detail

elementsback to summary
protected List<K> elements

Track the elements as they are added to the set

Constructor Detail

OrderedHashMapback to summary
public OrderedHashMap()

Method Detail

clearback to summary
public void clear()

Overrides java.util.LinkedHashMap.clear.

Implements java.util.Map.clear.

Doc from java.util.LinkedHashMap.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
getElementback to summary
public V getElement(int i)
getKeyback to summary
public K getKey(int i)
putback to summary
public V put(K key, V value)

Overrides java.util.HashMap.put.

Implements java.util.Map.put.

Doc from java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Parameters
key:K

key with which the specified value is to be associated

value:V

value to be associated with the specified key

Returns:V

the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)

Annotations
@Override
putAllback to summary
public void putAll(Map<? extends K, ? extends V> m)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

Doc from java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress. If the specified map has a defined encounter order, processing of its mappings generally occurs in that order.

Parameters
m:Map<? extends K, ? extends V>

mappings to be stored in this map

Annotations
@Override
removeback to summary
public V remove(Object key)

Overrides java.util.HashMap.remove.

Implements java.util.Map.remove.

Doc from java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that Objects.equals(key, k), that mapping is removed. (The map can contain at most one such mapping.)

Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

If this map permits null values, then a return value of null does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to null.

The map will not contain a mapping for the specified key once the call returns.

Parameters
key:Object

key whose mapping is to be removed from the map

Returns:V

the previous value associated with key, or null if there was no mapping for key.

Annotations
@Override