The Collections Framework
Java provides a Collections Framework, a set of classes in the java.util package, that enable the programmer to store and manipulate data in various ways. This library makes it very easy for the programmer to create and manipulate collections of information. Additionally, the implementations are optimized for efficiency. Many other programming languages also support a similar library.
Though having such a library makes life easier for the programmer, it is
extremely important that students learn how such libraries are implemented.
ArraysThe array is the most basic type of collection. Though other types of collections are easier to use, we'll begin with arrays. It is very important for you to understand how to use and manipulate arrays. An array allows the programmer to store a list of elements, all of the same type , in a contiguous block of memory. The size of an array must be specified when it is instantiated and cannot change. Declaring Arrays
An array declaration creates a reference to the first element of the
array. The declaration includes the type of the elements that will be stored
in the array, a name for the array, and the square brackets ([]) specify that
the variable will be an array.
|