Java Reference
In-Depth Information
1 package weiss.nonstandard;
2
3 // LinkedList class
4 //
5 // CONSTRUCTION: with no initializer
6 // Access is via LinkedListIterator class
7 //
8 // ******************PUBLIC OPERATIONS*********************
9 // boolean isEmpty( ) --> Return true if empty; else false
10 // void makeEmpty( ) --> Remove all items
11 // LinkedListIterator zeroth( )
12 // --> Return position to prior to first
13 // LinkedListIterator first( )
14 // --> Return first position
15 // void insert( x, p ) --> Insert x after current iterator position p
16 // void remove( x ) --> Remove x
17 // LinkedListIterator find( x )
18 // --> Return position that views x
19 // LinkedListIterator findPrevious( x )
20 // --> Return position prior to x
21 // ******************ERRORS********************************
22 // No special errors
23
24 public class LinkedList<AnyType>
25 {
26 public LinkedList( )
27 { /* Figure 17.9 */ }
28
29 public boolean isEmpty( )
30 { /* Figure 17.9 */ }
31 public void makeEmpty( )
32 { /* Figure 17.9 */ }
33 public LinkedListIterator<AnyType> zeroth( )
34 { /* Figure 17.9 */ }
35 public LinkedListIterator<AnyType> first( )
36 { /* Figure 17.9 */ }
37 public void insert( AnyType x, LinkedListIterator<AnyType> p )
38 { /* Figure 17.14 */ }
39 public LinkedListIterator<AnyType> find( AnyType x )
40 { /* Figure 17.11 */ }
41 public LinkedListIterator<AnyType> findPrevious( AnyType x )
42 { /* Figure 17.13 */ }
43 public void remove( Object x )
44 { /* Figure 17.12 */ }
45
46 private ListNode<AnyType> header;
47 }
figure 17.8
The LinkedList class skeleton
Search WWH ::




Custom Search