Collection is a major part of the Java programming language. It is difficult to learn, but it pays once you are familiar with them. The following short articles use simple examples to explain the key ideas.
- Collections Hierarchy Diagram
- Collection classes summary table
- Set: HashSet vs. TreeSet vs. LinkedHashSet
- List: ArrayList vs. LinkedList vs. Vector
- Map: HashMap vs. TreeMap vs. Hashtable vs. LinkedHashMap
- Top 10 questions about Java Collections
- Top 9 questions about Java Maps
- Make an efficient counter using HashMap
- Set vs. Set<?>
More Code Examples
- 3 frequently used methods for HashMap
- Set for a Collection of Unique Data
- TreeSet - Simple Example
- TreeSet - Implement Comparable
- Sorting Arrays
- Sort a linked list of self-defined objects
- Convert Hashtable to TreeMap
- Why do we need generic types in Java?
- Why do we need generic methods?
- Generic Types vs. Generic Methods
- Java Type Erasure Mechanism
- 3 examples to explain common mistakes when using Java Generics