View RSS Feed

Algorithm and Data Structure

Algorithm and data structure examples in Java.

  1. Removing an Item from the List

    by , 02-19-2012 at 06:52 AM
    For removal of an item out of List, different methods would be discussed here. Use these methods.

    • remove()
    • removeFirst()
    • removeLast()


    Java Code: This is the code to explain removal of an element from the List
    theList.removeLast();
    theList.remove(0);
    theList.removeFirst();
    theList.removeFirst();
    
    import java.util.*;
    public class TestLinkedList
    {
    public static void main(String[] args)
    {
    int pause;
    String temp;
    LinkedList theList = new LinkedList();
    ...
    Tags: remove item Add / Edit Tags
    Categories
    Linked List