Site MapHelpFeedbackChapter Overview
Chapter Overview
(See related pages)

In this chapter we introduced the List interface, which extends the Collection interface by adding several index-based methods. We then studied the ArrayList class, an implementation of the List interface that allows random access—that is, constanttime access—of any element from its index. Using an ArrayList object is similar to using an array, but one important difference is that ArrayList objects are automatically resizable. When an ArrayList outgrows the current capacity of its underlying array, an array of 1.5 times that size is created, and the old array is copied to the larger array. This is similar to what hermit crabs do each time they outgrow their shell. A further advantage of ArrayList objects over arrays is that, for inserting and deleting, users are relieved of the burden of writing the code to make space for the new entry or to close up the space of the deleted entry.

The application of the ArrayList class was in high-precision arithmetic, an essential component of public-key cryptography.







CollinsOnline Learning Center

Home > Chapter 6 > Chapter Overview