|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiitb.con.util.KeyList<K,V>
public class KeyList<K extends java.lang.Comparable<K>,V>
KeyList is a generic key-value pair list. The values are inserted and removed based on the key. It differs from the HashMap structure by maintaining it as a list and uses binary search to add and retrieve the objects.
Nested Class Summary | |
---|---|
static class |
KeyList.Entry<K extends java.lang.Comparable<K>,V>
Generic class for key-value pair data |
Constructor Summary | |
---|---|
KeyList()
|
Method Summary | |
---|---|
boolean |
add(K key,
V value)
Adds to the list |
V |
get(K key)
Gets the value object for the specified key, if it matches. |
V |
getNext(K key)
Gets the next value object of the specified key for nearest match. |
V |
getPrev(K key)
Gets the previous value object of the specified key for nearest match. |
boolean |
remove(K key)
Removes from the list |
int |
size()
Returns the list size |
void |
sort()
Sorts the key list |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyList()
Method Detail |
---|
public boolean add(K key, V value)
key
- key that used to addvalue
- value object
public V get(K key)
key
- key to retrieve the object
public V getNext(K key)
key
- key to retrieve the object
public V getPrev(K key)
key
- key to retrieve the object
public boolean remove(K key)
key
- key that used to remove the value objectpublic int size()
public void sort()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |