- It is the child interface of collection.
- Duplicates are allowed
- If we want to represent a group of individual objects as a single entity where insertion order is preserved then we should go for list.
- We can differentiate duplicates by using index.
- We can preserve insertion order by using index, hence index play very important role in list interface.
List of 10 elements where index starts with 0 to 9. Index goes from 0 to 9. 0 & 9th position contains the same element.
Methods of List:-
void add(int index, Object o)
boolean addAll(int index, Collection c)
object get(int index)
object remove(int index)
object set(int index, Object new)
int indexOf(Object o)
int lastIndexOf(Object o)
427 total views, 1 views today