LinkedList in Java


  • The Underlying data structure is double Linked List.
  • Insertion order is reserved
  • Duplicate objects are allowed
  • Heterogeneous objects are allowed
  • Null insertion is possible
  • Implements Serializable & cloneable interfaces but not Random Access Interfaces.
  • Best suitable if our frequent operation insertion or deletion in the middle.
  • Worst choice if our frequent operation is retrieval

 


Constructors of LinkedList:

  1. Linked List l = new LinkedList();
  • Creates an empty linked list object

2. Linked list l = new linkedlist(collection C)


Linked List Specific methods:

 

  • Void addFirst(Object o);
  • Void addLast(Object o);
  • Object removeFirst();
  • Object removeLast();
  • Object getFirst();
  • Object getLast();

 

Leave a Reply

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