//LinkedList Example Program for remove(Object o) /** * @author candidjava.com * @description: //this method removes the first occurrence of the specified element from this list. */ import java.util.LinkedList; public class Link { public static void main(String args[]) { LinkedList l = new LinkedList();// create object for linkedlist. l.add("e"); l.add("f"); l.add("d"); l.add("s"); l.add("a"); l.add("d"); System.out.println("before removing" + l); l.remove("d");// removes first occurence of the specified object from // list. System.out.println("after removing:" + l); } } <span style="color: #3366ff;">Output:</span> before removing[e, f, d, s, a, d] after removing:[e, f, s, a, d]
BACK