Ben Caradoc-Davies ha scritto:
> On 15/06/10 15:50, Andrea Aime wrote:
>> Developer depending on hashmap order ->  chaos
>> It's not the fault of poor hashmap that developers use it in a number
>> of places where it's unnecessary if not even harmful.
> 
> But the poor developers cannot know if they are getting a HashMap if 
> they are a module consumer and use, for example:
> 
> Map<String, String> getNamespaceSchemaLocationMap();
> 
> Is iteration over these namespaces stable across platforms? If we add 
> one namespace is their order jumbled?
> 
> The module implementor who allows an instance of HashMap to be exposed 
> has exposed the iteration order of the HashMap to an unsuspecting module 
> user. I have nothing against HashMaps that are kept well hidden, but 
> HashMaps allowed to leak out of confinement have an unerring ability to 
> make program behaviour vary across platforms.

I still see an incompetent developer in action there.
You look at that interface, you get a Map, so you know:
- the API designer decided the iteration order was not important
- the iteration order cannot be trusted

If you still rely on a specific iteration order well, you're the cause
of your own undoing...

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to