commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moritz Petersen" <moritzpeter...@mac.com>
Subject RE: [lang] ArrayUtils toMap asMap, [was Re: [collections] [PATCH] MapUtil]
Date Tue, 15 Oct 2002 08:38:04 GMT
Great.

> I believe that this difficulty is the reason why asMap(Object[]) was never
> included in the JDK, but toMap() was.
>
> Here is my solution:
> - Hashing - document the behaviour, stating that the Map will
> behave poorly
> as its size grows. And that it returns the first matched key.
>
> - Changing the underlying objects - the best solution I can think of is to
> treat what we have previously considered invalid values as both key and
> value. Thus
> new Object[] {null, "abba", new Object[] {"foo", "bar"}}
> has 3 key value entries:
> null -> null
> "abba" -> "abba"
> "foo" -> "bar"
>
> This way, the Map contents are always valid (ignoring the duplicate keys
> issue, which cannot be solved)
>
> - values, entrySet, keySet, iterator - implemented as best per the spec
>
> However, before any work occurs, I'd like to ask other [lang]
> committers if
> they agree that such a beast is still useful, or whether it is too loose.


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message