my questions about Write a Java program to construct a LinkedList -


write java program construct linkedlist , following tasks: (a) insert 5 elements list. (b) add 1 node @ first position (c) add 1 node @ last position (d) add 1 node @ second position (e) print contents of list using listiterator. (f) remove first, third , last element list (g) change value of second node. (h) print list without using list iterator

i think looking like:  <code>     linkedlist<string>  linkedlist = new linkedlist<string>();         // add 5 elements         linkedlist.add("item1");         linkedlist.add("item2");         linkedlist.add("item3");         linkedlist.add("item4");         linkedlist.add("item5");                 system.out.println("list =["+linkedlist+"]");         /*add first*/         linkedlist.addfirst("item0");         system.out.println("list =["+linkedlist+"]");         //add last         linkedlist.addlast("item6");         system.out.println("list =["+linkedlist+"]");         //add second         linkedlist.add(1, "item02");         system.out.println("list =["+linkedlist+"]");         linkedlist.removefirst();         linkedlist.remove(1); // remove 3rd         linkedlist.removelast();         system.out.println("list =["+linkedlist+"]"); </code> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -