We have three classes implementing list interface in java Collection framework hierarchy. Look at the diagram given below:

list interface java radar

From the diagram its clear that classes implementing list interface are:

1. ArrayList

  • Arraylist was added in Java 1.2 version.
  • Arraylist uses grow able array and thus can grow automatically.
  • Arraylist in java is not synchronized or thread safe.
  • As arraylist is non-synchronized so it is better performance wise as multiple threads can access the resources of arraylist at the same time simultaneously.
  • Arraylist’s  iterator and list iterator are fail fast in nature.
  • Follow the link to read in detail about arraylist

Read: Why iterator on arraylist is fail fast in java?

2. LinkedList

  • Linkedlist was added in Java 1.2 version
  • Linkedlist in java is not synchronized
  • Linkedlist stores element in nodes which has capability to store element and its address.
  • Follow the link to read in detail about linkedlist

Read: Difference Arraylist vs Linkedlist

3. Vector

  • Vector is synchronized in nature. This is the major difference between array list and vector.
  • Vector is a legacy class and is not recommended to be used at present.
  • Follow the link to read in detail about vector
You may also like to read about:
  • What classes implement Set interface in java?
  • Can we call run() directly on thread without calling start?
  • Class variable vs instance variable
  • iterator vs list iterator
  • Why String is immutable in java?
  • What is marker interface?
  • Why java is secure as programming language?
  • Collection vs Collections
  • Class variable vs instance variable

Source link

What are the classes implementing List interface?

Leave a Reply

Your email address will not be published. Required fields are marked *