Stephen,
> By comparison with the JDK, the method asList(Object[]) is on > Arrays. Thus I > have applied the patch to ArrayUtils in [lang] instead of [collections]. you're right, that makes sense. > When I looked at asMap(Object[]) I discovered certain problems that we > hadn't considered: > - the array doesn't behave like a Map when looking up keys because its not > hashed Problem with this is, that asMap() returns the 'ArrayMap' object, that just accesses the backup array. Hashing the keys would mean to create a new hashed representation of the array, and to keep it in sync with the actual keys. The question is, if it is worth it. > - what happens if someone changes the underlying array, to put an illegal > object type or null into the array Operations on the array may be dangerous, after calling asMap(). Because the returned ArrayMap is evaluated lazy, changes to the array are handled the same way as if they have been inside before calling asMap(): they will cause a NullPointerException or an IllegalArgumentException. If this is the desired response is questionable. > - the implementation didn't correctly handle the values(), entrySet() or > keySet() methods which should provide a view onto the real data > (which would > actually be tricky to implement). Indeed, that would be way more complicated than the current implementation. I think a little bit more effort would be reasonable. So, at least the last point should be implemented for a correct behaviour. About the other I am not sure (especially at the first point I am not sure what the best way would be to handle it elegantly). -Moritz. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
