net.sf.jasperreports.engine.util
Class LinkedMap<K,V>

java.lang.Object
  extended by net.sf.jasperreports.engine.util.LinkedMap<K,V>

public class LinkedMap<K,V>
extends java.lang.Object

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:

Version:
$Id: LinkedMap.java 4732 2011-10-21 09:14:15Z lucianc $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Nested Class Summary
protected static class LinkedMap.LinkedValue<K,V>
           
 
Constructor Summary
LinkedMap()
          Creates a list.
 
Method Summary
 void add(K key, V value)
          Adds a value at the end of the list.
 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.
 V remove(K key)
          Removes and returns an element mapped to a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedMap

public LinkedMap()
Creates a list.

Method Detail

add

public void add(K key,
                V value)
Adds a value at the end of the list.

Parameters:
key - the not-null key to which the value is mapped
value - the value

addFirst

public void addFirst(K key,
                     V value)
Adds a value at the start of the list

Parameters:
key - the not-null key to which the value is mapped
value - the value

isEmpty

public boolean isEmpty()
Determines whether the list is empty.

Returns:

pop

public V pop()
Removes and returns the first element in the list.

Returns:

remove

public V remove(K key)
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


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com