- Java Collections Tutorial
- Java Collections - Overview
- Java Collections - Iterable
- Java Collections - Collection
- Java Collections - Generic Collections
- Java Collections - List
- Java Collections - Set
- Java Collections - SortedSet
- Java Collections - NavigableSet
- Java Collections - Map
- Java Collections - SortedMap
- Java Collections - NavigableMap
- Java Collections - Queue
- Java Collections - Deque
- Java Collections - Stack
- Java Collections - hashCode() and equals()
- Java Collections - Sorting
- Java Collections - Streams
Java Collections Tutorial
The Java Collections API's provide Java developers with a set of classes and interfaces that makes it easier to handle collections of objects. In a sense Collection's works a bit like arrays, except their size can change dynamically, and they have more advanced behaviour than arrays.
Rather than having to write your own collection classes, Java provides these ready-to-use collection classes for you. This tutorial will look closer at the Java Collection's, as they are also sometimes referred to, and more specifically the Java Collections available in Java 6.
The purpose of this tutorial is to give you an overview of the Java Collection classes. Thus it will not describe each and every little detail of the Java Collection classes. But, once you have an overview of what is there, it is much easier to read the rest in the JavaDoc's afterwards.
Most of the Java collections are located in the
java.util package. Java
also has a set of concurrent collections in the
package. This tutorial will not describe the concurrent collections. These will be
described in their own tutorial some time in the future.
Overview of Java Collections
To help you get an overview of the Java Collections classes and interfaces, the first text in this Java Collections tutorial is the Overview of Interfaces text.
The Central Java Collection Interfaces
Java Collections and Generics
The fifth text in this Java Collections tutorial covers how to use Generics in Java Collections. Generics is very useful when working with Java's Collection classes.
Java Collections and the equals() and hashCode() Methods
The last two texts in this Java Collections tutorial explains the central role the two
hashCode() play when using Java Collections. You should read this,
if you plan to use Java Collections with your own classes, and thus need to implement