Difference Between List and ArrayList in Java

JavaServer Side ProgrammingProgramming

In this post, we will understand the difference between List and ArrayList in Java.

List

  • It is an Interface.

  • It extends the Collection framework.

  • It can’t be instantiated.

  • It can be used to create a list of elements/objects.

  • These objects are associated with their index numbers.

  • It creates a collection of elements which are stored in a sequence.

  • These elements are identified and accessed using an index.

ArrayList

  • It is a class.

  • It extends the ‘AbstractList’ class.

  • It implements ‘List’ interface.

  • It can be instantiated.

  • This class is used to create a dynamic array, which would contain objects.

  • It creates an array of object.

  • This array can be developed dynamically.

raja
Published on 24-Mar-2021 12:38:47
Advertisements