J.5. Lists
A List is an ordered Collection that can contain duplicate elements. Like array indices, List indices are zero based (i.e., the first element’s index is zero). In addition to the methods inherited from Collection, interface List provides methods for manipulating elements via their indices, manipulating a specified range of elements, searching for elements and obtaining a ListIterator to access the elements.
Interface List is implemented by several classes, including ArrayList (introduced in Appendix E) and LinkedList. Class ArrayList is a resizable-array implementation of List. Inserting an element between existing elements of an ArrayList is an inefficient operation—all elements after the new one must be moved out of the way, which ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access