ABSTRACT

This chapter explains arrays, sets, lists, and maps in Java and iterating with the collection. An array in Java is an object that includes items of the same data type. Furthermore, array items are kept in a continuous memory region. It is a data structure in which related components are stored. A Java array can only hold a fixed number of items. The collection interface is inherited by the list interface, which is available in java.util package. Iteration is one of the most fundamental operations performed on a collection. Iterations essentially extract components from a collection one after the other, from the first to the last.