List 13.1 Linklist/linkedlisttest.java
Linklist of Java Containers
Package Linklist;import Java.util.linkedlist;import Java.util.list;import Java.util.listiterator;public class Linklisttest{public static void Main (String args[]) {list<string> a=new linkedlist<> (); A.add ("Amy"); A.add ("Doug"); A.add ("France"); A.add ("Gloria"); List<string> b=new linkedlist<> () b.add ("BOAA"); B.add ("Bode"); B.add ("BDFV"); Listiterator<string> Aiter=a.listiterator (); Listiterator<string> Biter=b.listiterator (); while (Biter.hasnext ()) {if (Aiter.hasnext ()) Aiter.next (); Aiter.add (Biter.next ());} WhileSystem.out.println (a); Biter=b.listiterator (); while (Biter.hasnext ()) {biter.next (); if (Biter.hasnext ()) { Biter.next (); Biter.remove ();}} System.out.println (b); A.removeall (b); System.out.println (a);} Main}//linklisttest
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java Core Technology Volume 1 Fundamentals List 13.1