From: Ken Bloom Date: 2009-03-05T02:38:48+09:00 Subject: Re: Any solutions to Ruby's inconsistencies? On Wed, 04 Mar 2009 12:01:27 -0500, James Coglan wrote: > [Note: parts of this message were removed to make it a legal post.] > > >> >> > Or is my C.S. idea of a Hash too limited? Granted in Java they have >> > HashMap, but if you enter one value and get a second one out it is a >> > Map, regardless of how the keys are stored. >> >> Hey, why aren't Arrays called Maps instead? > > > > I've always found Java's naming of collections to be contrary to its > idea of OO in that it exposes implementation details, e.g. HashSet, > LinkedHashSet and TreeSet really ought to be called Set, OrderedSet and > SortedSet to reflect their intended use rather than their internal > structure. No, no, no. In Java, you have the interfaces Set, and SortedSet (no OrderedSet, I suppose it would have exactly the same operations as a Set), which don't define any operations, and AbstractSet which is a helper class for people implementing sets. Then you create instantiations HashSet, LinkedHashSet, TreeSet, which you instantiate *knowing* what data you intend to use it for, and which behind-the-scenes implementation has the best performance characteristics for that data. (You *should* be allowed that choice, in general.) Then you pass those around using the aforementioned implementation-agnostic interfaces. -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/