Java Reference
In-Depth Information
21 boolean hasNext();
22
23 /**
24 Adds an element before the iterator
position
25 and moves the iterator past the
inserted element.
26 @param element the element to add
27 */
28 void add(E element);
29
30 /**
31 Removes the last traversed element.
This method may
32 only be called after a call to the
next method.
33 */
34 void remove();
35
36 /**
37 Sets the last traversed element to a
different
38 value.
39 @param element the element to set
40 */
41 void set(E element);
42 }
ch17/genlist/ListTester.java
1 /**
2 A program that tests the LinkedList class.
3 */
4 public class ListTester
5 {
6 public static void main(String[] args)
7 {
8 LinkedList<String> staff = new
LinkedList<String>();
9 staff.addFirst( ÐTomÑ );
10 staff.addFirst( ÐRomeoÑ );
11 staff.addFirst( ÐHarryÑ );
12 staff.addFirst( ÐDickÑ );
774
775
Search WWH ::




Custom Search