Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 8 Collection Types.

Similar presentations


Presentation on theme: "Chapter 8 Collection Types."— Presentation transcript:

1 Chapter 8 Collection Types

2 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.

3 Student Question Can a collection contain other collections?

4 Collection Interface The generic Collection interface defines a set of operations that characterize the behavior of most collection classes.

5 Collection Interface (cont’d)

6 Collection Interface (cont’d)

7 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?


Download ppt "Chapter 8 Collection Types."

Similar presentations


Ads by Google