jxl.util
Class StackMap<K,V>

java.lang.Object
  extended by jxl.util.StackMap<K,V>
All Implemented Interfaces:
java.util.Map<K,V>

public class StackMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>

A stack based implementation of the Map interface. Comment This Class will be moved to a util package in future a releases Also, most of the optional methods in the map return null. (I know thats wrong. Sigh...) Feel free to correct or implement these methods, but please do not allow Iterators to be mutable (do not support remove()). Thanks


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
StackMap()
          Creates a new instance of StackMap
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
           
 V get(java.lang.Object key)
           
 java.lang.Object getFirstKey()
           
 java.lang.Object getFirstValue()
           
 java.lang.Object getKeyAt(int index)
           
 java.lang.Object getLastKey()
           
 java.lang.Object getLastValue()
           
 java.lang.Object getValueAt(int index)
           
 boolean isEmpty()
           
 java.util.Set<K> keySet()
           
 void moveToTop(java.lang.Object key)
          moves key and the value it is bound with to the top of the StackMap
 V put(K key, V value)
           
 void putAll(java.util.Map<? extends K,? extends V> t)
           
 V remove(java.lang.Object key)
           
 java.lang.Object removeLast()
          removes the last key-value pair in this map
 void setKeyAt(K o, int index)
           
 void setValueAt(V o, int index)
           
 int size()
           
 java.util.Collection<V> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

StackMap

public StackMap()
Creates a new instance of StackMap

Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.Map<K,V>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<K,V>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<K,V>

entrySet

public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface java.util.Map<K,V>

get

public V get(java.lang.Object key)
Specified by:
get in interface java.util.Map<K,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<K,V>

keySet

public java.util.Set<K> keySet()
Specified by:
keySet in interface java.util.Map<K,V>

removeLast

public java.lang.Object removeLast()
removes the last key-value pair in this map

Returns:
returns the value Object of the key-value pair that is removed

getFirstKey

public java.lang.Object getFirstKey()

getLastKey

public java.lang.Object getLastKey()

getFirstValue

public java.lang.Object getFirstValue()

getLastValue

public java.lang.Object getLastValue()

put

public V put(K key,
             V value)
Specified by:
put in interface java.util.Map<K,V>

moveToTop

public void moveToTop(java.lang.Object key)
moves key and the value it is bound with to the top of the StackMap


putAll

public void putAll(java.util.Map<? extends K,? extends V> t)
Specified by:
putAll in interface java.util.Map<K,V>

remove

public V remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<K,V>

size

public int size()
Specified by:
size in interface java.util.Map<K,V>

values

public java.util.Collection<V> values()
Specified by:
values in interface java.util.Map<K,V>

getKeyAt

public java.lang.Object getKeyAt(int index)

getValueAt

public java.lang.Object getValueAt(int index)

setKeyAt

public void setKeyAt(K o,
                     int index)

setValueAt

public void setValueAt(V o,
                       int index)