Below is code A:
/ * * CREATED ON 2005-3-21 * /
/ ** * @author jtzhu * / import java.util.NoSuchElementException; import java.util.Date; public class list {class Element {final int datum; Element next; Element (final int datum, Element next) {this.datum = DATUM; this.next = next;}} class it {element curr; ney {this.curr = head;} Boolean Hasnext () {Return Curr! = NULL;} int next () {IF (Curr == null) throw new NoSuchElementException (); final int result = curr.datum; curr = curr.next; return result;}}; Element head; Element tail; list () {head = tail = null;} boolean isEmpty ( ) {RETURN head == null;} void purge () {Element curr = head; element next; while (curr! = Null) {Next = curr.next; curr = next;} head = tail = null;} void append Final Int Datum {If (head == null) {head = tail = new element (datum, null);} else {tail.next = new element (datum, null); tail = tail.next;}} void extract (Final Int Datum ) {If (iSempty ()) throw new nosuchelementexception (); element curr = head; element pre = null; while (curr! = Null && curr.datum! = Datum) {pre = curr; curr = curr.next;} IF (curr == null) throw new nosuchelementexception (); if (curr == head) {Element next = head.next; head = next;
} Else {pre.next = curr.next;} if (curr == tail) tail = pre;} void assign (this == Another) Return; iter perite = another.iterator (); purge (); {Append (iter.next ());}}}}}}}}}}} public static void main (String [] args) {list from = New list (); list to = new list (); final INT length = 100000; Final INNNERLOOPS = 100; for (int i = 0; i (end-start); System.out.print ("Extract:" 1000 / TimeUse "K / S / T"); TimeUse = 0; for (int K = 0; K Javac List.javajava List