|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprea.datastructure.DataMap<Key,Val>
public class DataMap<Key extends java.lang.Comparable<Key>,Val>
This is a class implementing HashMap-based data map. This data structure is used for implementing sparse vector and matrix.
| Field Summary | |
|---|---|
private java.util.HashMap<Key,Val> |
map
Key-value mapping structure |
| Constructor Summary | |
|---|---|
DataMap()
Basic constructor without specifying the capacity. |
|
DataMap(int capacity)
A constructor specifying the capacity. |
|
| Method Summary | |
|---|---|
boolean |
contains(Key key)
Check whether the map has a specific key inside it. |
Val |
get(Key key)
Get a data value by the given key. |
int |
itemCount()
Count the number of elements in the map. |
java.util.Iterator<Key> |
iterator()
Get an iterator for the map. |
void |
put(Key key,
Val value)
Set a data value with the given key. |
Val |
remove(Key key)
Remove a data element with the given key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.HashMap<Key extends java.lang.Comparable<Key>,Val> map
| Constructor Detail |
|---|
public DataMap()
public DataMap(int capacity)
| Method Detail |
|---|
public Val get(Key key)
key - The key to search.
public void put(Key key,
Val value)
key - The key to set.value - The data value associated with the given key.public Val remove(Key key)
key - The key to remove.
public boolean contains(Key key)
key - The key to search.
public java.util.Iterator<Key> iterator()
iterator in interface java.lang.Iterable<Key extends java.lang.Comparable<Key>>public int itemCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||