Algorithm
Development Kit 1.0

algs.model.search
Interface IHashtableAccess<K,V>

All Known Implementing Classes:
AssociativeHashTable, HashTable, ListHashTable

public interface IHashtableAccess<K,V>

Abstraction of methods that one expects a Hashtable to perform.

If subclasses are unable to perform the actions as specified in this interface, they may throw an IllegalStateException to alert users that they are no longer consistent.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman, Gary Pollice

Method Summary
 V add(K k, V v)
          Associate element v with key k.
 V remove(K k)
          Remove the entry from the hash table.
 boolean search(K k)
          Determine if element exists within the hash table.
 int size()
          Return the number of elements in the hash table.
 

Method Detail

size

int size()
Return the number of elements in the hash table.


search

boolean search(K k)
Determine if element exists within the hash table.

Parameters:
k - key of target item to be searched.
Returns:
true if element exists within the hash table; false otherwise.

remove

V remove(K k)
Remove the entry from the hash table.

Parameters:
k - key of target item to be removed.
Returns:
object of class V if previously associated in the Hash table with the given key; null otherwise.

add

V add(K k,
      V v)
Associate element v with key k.

Parameters:
k - key to be added to the Hash table entries
v - target item to be associated with the key
Returns:
null if no such element associated in the Hash Table with the given key; otherwise returns V objects that was previously associated with that object.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.