> Although it's far from certain, after over a decade of work it looks like a design for parametric polymorphism, what is colloquially but misleadingly called generics...
What exactly is misleading about generics?
The psychology of thought leaders is fascinating. The term generics is colloquially understood to mean parametric polymorphism and here's Pike redefining the term to draw some distinction that doesn't really exist just to remain self-consistent.
Come to think of it, this is a really common pattern. If you've made remarks that you must now backtrack then refine terms until your old writing doesn't seem to contradict your current stance because you can just say people were using the terms wrong and you were right.
Some results for searching "generics": https://www.amazon.com/Java-Generics-Collections-Development....
They are entirely different constructs. A HashMap is an implementation of Map. A Map maps keys to values. The key look up occurs using the hash.
On the other hand, a HashSet is an implementation of Set. A Set is designed to match the mathematical model of a set. A HashSet does use a HashMap to back its implementation, as you noted. However, it implements an entirely different interface.
When you are looking for what will be the best Collection for your purposes, this Tutorial is a good starting place. If you truly want to know what's going on, there's a book for that, too.
What exactly is misleading about generics?
The psychology of thought leaders is fascinating. The term generics is colloquially understood to mean parametric polymorphism and here's Pike redefining the term to draw some distinction that doesn't really exist just to remain self-consistent.
Come to think of it, this is a really common pattern. If you've made remarks that you must now backtrack then refine terms until your old writing doesn't seem to contradict your current stance because you can just say people were using the terms wrong and you were right.
Some results for searching "generics": https://www.amazon.com/Java-Generics-Collections-Development....
Read the Angelika Langer FAQ About Generics you will most likely find answers to all your questions there.
The book The Java Programming Language 4th Edition contains a good chapter on the subject.
And of course there is no better reference than the Java Language Specification which you can get for free.
The book Java Generics and Collections is also a very good book on the subject if you really intend to go that deep. I found a PDF version of the book here. Unfortunately it only contains a few pages.
Circular generic references are indeed possible. Java Generics and Collections includes several examples. For your case, such a specimen would look like this:
They are entirely different constructs. A
HashMap
is an implementation ofMap
. A Map maps keys to values. The key look up occurs using the hash.On the other hand, a
HashSet
is an implementation ofSet
. A Set is designed to match the mathematical model of a set. AHashSet
does use aHashMap
to back its implementation, as you noted. However, it implements an entirely different interface.When you are looking for what will be the best
Collection
for your purposes, this Tutorial is a good starting place. If you truly want to know what's going on, there's a book for that, too.