Chapter 8 Collection Types
Collection A collection is an object that holds other objects. It is a storage mechanism with operations for adding and removing elements and for accessing and perhaps updating their values.
Student Question Can a collection contain other collections?
Collection Interface The generic Collection interface defines a set of operations that characterize the behavior of most collection classes.
Collection Interface (cont’d)
Collection Interface (cont’d)
Student Question Why did the methods contains and remove have a parameter of type Object instead of a parameter of the generic type T? Why does the toArray method return an array of Objects rather than an array of generic type T?