Skip to main content
Lesson 33 - Java Lists and Iterators
Lesson MenuPreviousNext
  
LinkedList Library Implementation of the List Interface page 4 of 7

  1. The java.util package of the standard class library has a LinkedList class. The LinkedList class implements the List interface. As the class name indicates, the underlying implementation of the LinkedList class is a linked list.

  2. In addition to the methods specified by the List interface, the LinkedList class provides a few specialized methods that allow easy access to both ends of the list as follows:

    void addFirst(Object element)
    // Inserts the given element at the beginning of this list.
    
    void addLast(Object element)
    // Appends the given element to the end of this list.
    
    Object getFirst()
    // Returns the first element in this list
    
    Object getLast()
    // Returns the last element in this list
    
    Object removeFirst()
    // Removes and returns the first element from this list
    
    Object removeLast()
    // Removes and returns the last element from this list


Lesson MenuPreviousNext
Contact
 ©ICT 2003, All Rights Reserved.