Using char[] as key in a HashMap

Avinash Lakshman <[email protected]> Wed, 30 Jan 2008 01:24:36 -0600
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
Hi All

In the application that we are building we have the need to maintain some objects in memory in a HashMap keyed by a String. But it seems that the overhead of the String is such that the overhead is more than the length of the characters in the String. I was thinking of reducing the memory footprint significantly by replacing the key with a char[] of the String. How can I achieve this? How can I implement the hashCode() and equals() of char[]? Do I have to do it with a class that wraps the char[]?

Thanks
A

_________________________________________________________________
Shed those extra pounds with MSN and The Biggest Loser!
http://biggestloser.msn.com/
===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com