Re: How can i implements a class like an HashMap but with 2 keys ?
- From: Patricia Shanahan <pats@xxxxxxx>
- Date: Wed, 29 Aug 2007 06:10:46 -0700
Roedy Green wrote:
On Tue, 28 Aug 2007 14:02:21 +0200, Rob <nomail@nomail> wrote, quoted....
or indirectly quoted someone who said :
i am a newbie, i want to create a class that works like an HashMap but
with 2 keys, get(key1,key2) -> value
3. concatenate your two String keys into one.
I'd avoid this one unless there is at least one char bit pattern that
cannot appear in the first input, to use as separator.
For example, using "_" for the separator, the key "A_B_C" would be used
for both ("A_B","C") and ("A","B_C"), making it impossible to
distinguish those pairs.
This can be worked around by an encoding step before the concatenation,
but that makes it all more complicated, and simplicity is the main merit
of this method.
Patricia
.
- Follow-Ups:
- Re: How can i implements a class like an HashMap but with 2 keys ?
- From: Gordon Beaton
- Re: How can i implements a class like an HashMap but with 2 keys ?
- References:
- Prev by Date: Re: OT. Amusing Variant on Nigeria Scam Spam
- Next by Date: Re: How can i implements a class like an HashMap but with 2 keys ?
- Previous by thread: Re: How can i implements a class like an HashMap but with 2 keys ?
- Next by thread: Re: How can i implements a class like an HashMap but with 2 keys ?
- Index(es):
Relevant Pages
|