Where to find an overview of backed Collection methods/classes
I am trying to find an overview of all metho开发者_如何学编程ds in the java.util
package returning backed Collections (and Maps). The only ones easy to find are the synchronizedXX
and immutableXX
. But there are others like subMap()
. Is there a more comfortable way to find out more about all util
methods returning backed collections than to actually read the docs? A visual overview maybe?
the tutorial for wrapped classes (has been proposed twice as an answer) at http://download.oracle.com/javase/tutorial/collections/implementations/wrapper.html is oblivious of the NavigableSet/Map interfaces and therefore does not provide an overview of methods returning backed Collections
I know this doesn't exactly answer your question (and I risk being down-voted), but I will try anyway.
You should try to study the collections API as much as you can, in general it is good advice for any programming language/platform to invest some time, and learn the basics.
When studying Java collections you will also notice some oddities in the design, and will also realize that there are many things that are not provided that you either have to build your own or get them from somewhere else (such as Apache commons).
In any case, using a modern IDE (such as IntelliJ IDEA or Eclipse) will make things a lot easier on you. Both have ways of searching for symbols with a few keystrokes and also let you navigate the collections API (and any source code you throw at them) making it a lot easier to figure out what is available and how you might take advantage of it.
Try this mnemonic to understand some methods from TreeSet
and TreeMap
.
It's a bit tricky though there's a numeric TreeSet
(1 2 3 4 5 6 7 8 9 10) below. So it's easy to remember that headSet()
& headMap()
methods work with the "Head" of the collection.
Also the mnemonic describes that there are two cases of using headSet
with different results:
headSet(element)
headSet(element, inclusive)
.
The tutorial has a page on wrapper classes.
精彩评论