Re: Using char[] as key in a HashMap
Avinash Lakshman <[email protected]> Wed, 30 Jan 2008 02:24:01 -0600
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
That's awesome. Thanks A > Date: Tue, 29 Jan 2008 23:28:33 -0800 > From: [email protected] > Subject: Re: [ADVANCED-JAVA] Using char[] as key in a HashMap > To: [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 _________________________________________________________________ Connect and share in new ways with Windows Live. http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008 =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com