








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































(^) It is a Pre packaged Implementation (^) A Java collection framework provides an architecture to store and manipulate a group of objects. (^) The JCF provides developers to access pre-packaged data structures as well as algorithms to manipulate data Java collections framework includes the following: (^) Interfaces: (^) are abstract data types that represent collections. (^) allow collections to be manipulated independently of the details of their representation. (^) Implementations, i.e., Classes: (^) are the implementation of the collection interfaces. (^) are reusable data structures. (^) Algorithm: (^) the methods which are used to perform operations such as searching and sorting, on objects that implement collection interfaces (^) are said to be polymorphic : that is, the same method can be used on many different implementations of the appropriate collection interface. 4
8
Output: java.util.ArrayList 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81 10 * 10 = 100
(^) Extends the Iterator interface (^) Defines three fundamental methods void add(Object o) boolean hasPrevious() Object previous() (^) The addition of these three methods defines the basic behavior of an ordered list (^) A ListIterator knows position within list.
(^) The indexed get and set methods of the List interface are appropriate to use since ArrayLists are backed by an array Object get(int index) Object set(int index, Object element) (^) Indexed add and remove are provided, but can be costly if used frequently void add(int index, Object element) Object remove(int index) (^) May want to resize in one shot if adding many elements void ensureCapacity(int minCapacity)