T
trippy
Hendrik Maryns said:-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message
trippy schreef:John C. Bollinger said:trippy wrote:
I want to use arrays as keys in a HashMap.
But a key has to be unique.
1 key to 1 value
And your point is?
There is nothing inherently unworkable with arrays being map keys;
arrays are objects, after all. You might as well argue that Strings
cannot be used as keys because they (often) contain multiple characters.
But arrays have more than one thing in them by definition.
Okay, say using this idea, you keep a list of users and their
information. Now, you have multiple people accessing the same user's
information because thisguy[0] will give you the same value as thisguy
[4].
I guess that's my point. 1 key to 1 value. With the arrays you'll have
multiple keys to values.
I guess if you want that, whatever but I think it's a bad idea. Why
don't you keep things in a plain old ArrayList if you're gonna do that.
Still don?t see your point. What?s the difference if I only want some
objects to be stored as a list, between ArrayList and array?
Actually, the difference would be between ArrayList and Map (probably
HashMap) ArrayList wouldn't require the 1 key to 1 value like a map
would.
Only for
reading, I see no point in using a List.
H.
--
trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM
NP: "I Am The Law" -- Anthrax
"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."
-- Robert Redford "Spy Game"