11:19 pm - Sunday February 19, 2017

Remove a Specific Indexed Element from LinkedList by its key V remove(Object key)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

This tutorial explains how  to Remove a Specific Indexed Element  from LinkedList by its key using V remove(Object key) method.

Removes all of this collection’s elements that are also contained in the specified collection

 After this call returns, this collection will contain no elements in common with the  specified   collection.

Example

import java.util.ArrayList;

import java.util.List;

public class  RemoveElement

{

   public static void main(String a[])

 {         

           List<String> f=new ArrayList<String>();

               //List<String> firstList = new ArrayList<String>();        

               f.add("Jwalant");

               f.add("Hiren");

               f.add("Piyush");                

               f.remove(2);

               System.out.println(f);
   }

}

Output  

       [Jwalant, Hiren]

BACK

Filed in: Java Examples

Comments are closed.