Understanding the Collections Framework
Once an array is instantiated, it cannot have its length increased or decreased. This means that you must know the exact number of elements you will need before you instantiate the array. You can use a variable to declare the array but once created it cannot be resized. Have a look at the following example:
int numberOfCats = 6; int[] cats = new int[numberOfCats];
This is where collections come in. These are dynamic data structures that can increase in size as elements are added. You can also remove elements, although reducing the size is not always available, and if it can be reduced, then you must call an appropriate method.
The Collections Framework is divided into implementations and interfaces. An implementation may support more than one interface. While an implementation can have a large selection of methods, the use of an interface...