1152 Data Structures and Collections (Web server setup) Chapter 23 42
1152 Data Structures and Collections Chapter 23 42 43 // property Data 44 public object Data 45 { 46 get 47 { 48 return data; 49 } 50 } 51 52 } // end class ListNode 53 54 // class List definition 55 public class List 56 { 57 private ListNode firstNode; 58 private ListNode lastNode; 59 private string name; // string like “list” to display 60 61 // construct empty List with specified name 62 public List( string listName ) 63 { 64 name = listName; 65 firstNode = lastNode = null; 66 } 67 68 // construct empty List with “list” as its name 69 public List() : this( “list” ) 70 { 71 } 72 73 // Insert object at front of List. If List is empty, 74 // firstNode and lastNode will refer to same object. 75 // Otherwise, firstNode refers to new node. 76 public void InsertAtFront( object insertItem ) 77 { 78 lock ( this ) 79 { 80 if ( IsEmpty() ) 81 firstNode = lastNode = 82 new ListNode( insertItem ); 83 else 84 firstNode = 85 new ListNode( insertItem, firstNode ); 86 } 87 } 88 89 // Insert object at end of List. If List is empty, 90 // firstNode and lastNode will refer to same object. 91 // Otherwise, lastNode’s Next property refers to new node. 92 public void InsertAtBack( object insertItem ) 93 { Fig. 23.4 FiFiFiFig.g.g.g. 23232323.4.4.4.4Definitions of classes ListNode, Listand EmptyListException. (Part 2 of 5.)
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web and email hosting services