IMap (interface)

Usage

Linkage:

-lopenxds_adt

To use the interface:

#include <openxds.adt/IMap.h>

using namespace openxds::adt;

Method Summary

ReturnsMethod-nameParametersThrows
E* put const char* key E* element
E* remove const char* key
E* get const char* key NoSuchElementException*
IIterator(String)* keys
IIterator(E)* values
IIterator(E)* elements
bool isEmpty
long size

Methods


put

E* put( const char* key, E* element );

Parameters

key, that the element will be associated with;

element, to be mapped to key.

Returns

The element currently mapped to key; otherwise NULL.


remove

E* remove( const char* key );

Parameters

key, that may map to an element.

Returns

The element currently mapped to key; otherwise NULL.


get

E& get( const char* key ) throw (NoSuchElementException*);

Parameters

key, that may map to an element.

Returns

A reference to the element currently mapped to key; otherwise NULL.

Throws

NoSuchElementException, if the key is not in the map.


keys

IIterator<String>* keys();

Returns

A string iterator that iterates over the keys stored in the Map.


elements (values)

IIterator<E>* elements();

Returns

An element iterator that iterates over the elements stored in the map.

isEmpty

bool isEmpty();

Returns

TRUE, if the map is empty; otherwise FALSE.


size

long size();

Returns

The number of key/element mappings in the map.