public class LinkedMap<K,V> extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
LinkedMap.LinkedValue<K,V> |
Constructor and Description |
---|
LinkedMap()
Creates a list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value)
Adds a value at the end of the list.
|
void |
addAll(LinkedMap<K,V> map)
Adds all entries from the map to this map, preserving the order.
|
void |
addFirst(K key,
V value)
Adds a value at the start of the list
|
boolean |
isEmpty()
Determines whether the list is empty.
|
V |
pop()
Removes and returns the first element in the list.
|
Map.Entry<K,V> |
popEntry()
Removes and returns the first element in the list.
|
V |
remove(K key)
Removes and returns an element mapped to a key.
|
protected LinkedMap.LinkedValue<K,V> |
removeFirst() |
public void add(K key, V value)
key
- the not-null key to which the value is mappedvalue
- the valuepublic void addFirst(K key, V value)
key
- the not-null key to which the value is mappedvalue
- the valuepublic boolean isEmpty()
public V pop()
public Map.Entry<K,V> popEntry()
protected LinkedMap.LinkedValue<K,V> removeFirst()
public V remove(K key)
key
- null
if the key is not mappedCopyright © 2017. All rights reserved.