Welcome to Mike95.com
Home
WELCOME
ABOUT MIKE95.COM
CONTACT ME


Features
FUNNY JOKES
HUMAN FACTOR


C++
Library Source Code:
CGIPARSE
JSTRING
JVECTOR
JSTACK
JHASHTABLE


COM / ASP
MIKE95 COM SVR
- ASP STACK
- ASP QUEUE
- ASP VECTOR


Tutorials:
TEMPLATES
ALGORITHMS
DESIGN PATTERNS


Sample Work
Internet Based
TASK/BUG TRACKER


Visual C++ / MFC
FLIGHT PATH (C++)
MP3 PLAY LIST


Java
JAVA TALK
BAR GRAPH
WEB CAM


Personal
CONTACT ME
RESUME
PICTURES
TRIPS
JHashtable
Design of the library:

After converting the Java String library into a C++ equivalent and seeing the usefulness of using a common class with both languages, I decided to do the same for a few of the collection classes Java has available.

This class is a based on the Java 1.1 Hashtable class and as such contains all the public member functions of it's Java equivalent. In Java you may use any type as the key and any type as the value of the key, so to duplicate this in C++, a double template class was developed.

Note: Since Java 1.1 has hashItem() as a member of the base Object class, all Java classes are inherently hashable. Since the template parameter types do not necessarily have to have a built in hashing function, the user of the class must specify a user defined hash function by calling setHashFunction() passing a pointer to the hash function.

The has function must be declared as the following:
UINT function( const KeyType& );
Where:
function = any name you choose to use for the function name
KeyType = the type used for the key template parameter in the construction of the JHashtable object.

Example:

UINT myHash( const int& )
{
//your hashing code here for a key of type int.
}

Public functionality:
The library is fairly simple in usage. You may visit the Hashtable class specification at JavaSoft.


(c)2024 Mike95.com / Site Disclaimer
Site Meter