Re: Using char[] as key in a HashMap
Peter Booth <[email protected]> Wed, 30 Jan 2008 08:56:38 -0500
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
Avinash, Sorry for being a PITA but unless you want us to give folksy wisdom such as "apple pies are a good thing" you will need to provide a lot more data to answer the question: How big do you expect the hash to be? (number of elements) Are the strings random or meaningful (clustered)? How long are the strings? Is the access pattern read-mostly? and even .. Will the hash be (heavily) accessed from multiple threads such that contention is expected? Is it a server side or client side application? Is response time or throughput most important? Peter On Jan 30, 2008, at 2:24 AM, Avinash Lakshman wrote: > 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 =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com