|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.AbstractMap structure.Table
public class Table
An implementation of an ordered dictionary. Key-value pairs are kept in the structure in order. To accomplish this, the keys of the table must be comparable.
Comparable
Field Summary | |
---|---|
protected OrderedStructure |
data
An ordered structure that maintains the ComparableAssociations that store the key-value pairings. |
Constructor Summary | |
---|---|
Table()
Construct a new, empty table. |
|
Table(Table other)
|
Method Summary | |
---|---|
void |
clear()
Remove all the elements of the table. |
boolean |
containsKey(java.lang.Object key)
Determine if the key is in the table. |
boolean |
containsValue(java.lang.Object value)
Returns true if the value is associated with some key in the table. |
Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Retrieve the value associated with the key provided. |
boolean |
isEmpty()
Determine if the table is empty. |
java.util.Iterator |
iterator()
Construct an iterator over the values of the table. |
java.util.Iterator |
keys()
Construct an iterator over the keys of the table. |
Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Enter a key-value pair into the table. |
java.lang.Object |
remove(java.lang.Object key)
Remove a key-value pair, based on key. |
int |
size()
Determine the number of key-value pairs within the table. |
java.lang.String |
toString()
Construct a string representing value of table. |
Structure |
values()
|
Methods inherited from class structure.AbstractMap |
---|
hashCode, putAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface structure.Map |
---|
equals, hashCode, putAll |
Field Detail |
---|
protected OrderedStructure data
Constructor Detail |
---|
public Table()
public Table(Table other)
Method Detail |
---|
public java.lang.Object get(java.lang.Object key)
get
in interface Map
key
- The key of the key-value pair sought.
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface Map
key
- The unique key in the table.value
- The (possibly null) value associated with key.
public boolean isEmpty()
isEmpty
in interface Map
public void clear()
clear
in interface Map
public java.util.Iterator keys()
public java.util.Iterator iterator()
public boolean containsKey(java.lang.Object key)
containsKey
in interface Map
key
- A non-null key sought in the table.
public boolean containsValue(java.lang.Object value)
containsValue
in interface Map
value
- The value sought (possibly null).
public java.lang.Object remove(java.lang.Object key)
remove
in interface Map
key
- The key of the key-value pair to be removed.
public int size()
size
in interface Map
public Set keySet()
keySet
in interface Map
public Structure values()
values
in interface Map
public Set entrySet()
entrySet
in interface Map
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |