- It is the child interface of Collection.
- If we want to represent a group of individual objects as a single entity where duplicates are allow and insertion order is preserved. Then we should go for List.
- Insertion order will be preserved by means of Index.
- We can differentiate duplicate objects and we can maintain insertion order by means of index hence “index play very important role in List”.
- List interface defines the following specific methods.
- boolean add(int index,Object o);
- boolean addAll(int index,Collectio c);
- Object get(int index);
- Object remove(int index);
- Object set(int index,Object new); //to replace
- int indexOf(Object o); // Returns index of first occurrence of “o”.
- int lastIndexOf(Object o);
- ListIterator listIterator();
List interface contains 4 classes