INTRODUCTION OF ARRAYLIST

Introduction Of ArrayList


java.util.List:

  • List is the sub-interface of java.util.Collection interface

  • List object also allows us to add duplicates.

  • List object allows us to add an element either at the ending position or at specific position i.e. random insertion.

  • List object allows us to retrieve the data in forward direction, backward direction and in random retrieval.

  • In Collection interface there are 3 sub interfaces as listed bellow

      1. ArrayList
      2. LinkedList
      3. Vector
    Note

      ArrayList,LinkedList,Vector thsese three extends AbstractList.

java.util.ArrayList:

  • ArrayList is sub class to List interface.

  • For ArrayList we can add multiple data type values.

  • ArrayList can allow duplicate values. And null values also.

  • ArrayList supports random accessing of the elements by using index. It will give more performance.

  • ArrayList can allow random insertions also. But it will give less performance.

  • ArrayList also internally use the arrays only. Means it acts similar to an Array.

  • By using ArrayList we can get order of output by using index. Since it provides order of output, means in which order we insert the values, In same order it will give the output through the index based accessing.

  • Not only ArrayList but also any class which are subclass to Collection interface will supports index concept as well as order of output.

The common operations involved in collections framework are as follows:

  • Declaring and initializing the size to Collection.

  • Adding/inserting data into Collection.

  • Retrieving data from Collection.

  • Remove/Delete data from Collection.

  • Manipulation and customization Collection data.