Package net.sf.jasperreports.engine.util
Class LinkedMap<K,V>
java.lang.Object
net.sf.jasperreports.engine.util.LinkedMap<K,V>
A doubly linked list that can also map entries on keys.
The list can be iterated in FIFO order and implements the following operations
in constant time:
- adding an element at the start
- adding an element at the end
- finding and removing an element based on a key
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a value at the end of the list.void
Adds all entries from the map to this map, preserving the order.void
Adds a value at the start of the listboolean
isEmpty()
Determines whether the list is empty.pop()
Removes and returns the first element in the list.popEntry()
Removes and returns the first element in the list.Removes and returns an element mapped to a key.protected LinkedMap.LinkedValue
<K, V>
-
Constructor Details
-
LinkedMap
public LinkedMap()Creates a list.
-
-
Method Details
-
add
Adds a value at the end of the list.- Parameters:
key
- the not-null key to which the value is mappedvalue
- the value
-
addFirst
Adds a value at the start of the list- Parameters:
key
- the not-null key to which the value is mappedvalue
- the value
-
isEmpty
public boolean isEmpty()Determines whether the list is empty.- Returns:
- whether the list is empty
-
pop
Removes and returns the first element in the list.- Returns:
- the first element in the list
-
popEntry
Removes and returns the first element in the list.- Returns:
- the first element in the list
-
removeFirst
-
remove
Removes and returns an element mapped to a key.- Parameters:
key
-- Returns:
- the element mapped to the key,
null
if the key is not mapped
-
addAll
Adds all entries from the map to this map, preserving the order.- Parameters:
map
-
-