List interface

  1. It is the child interface of collection.
  2. Duplicates are allowed
  3. 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.
  4. We can differentiate duplicates by using index.
  5. 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)

ListIterator listIterator();

427 total views, 1 views today