Re: Using char[] as key in a HashMap
Bob Lee <[email protected]> Tue, 29 Jan 2008 23:28:33 -0800
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
Just wrap it with CharBuffer.wrap(char[]): http://java.sun.com/j2se/1.5.0/docs/api/java/nio/CharBuffer.html Bob On Jan 29, 2008 11:24 PM, Avinash Lakshman <[email protected]> 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(R) 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