Free web hosting with ftp - Chapter 23 Data Structures and Collections 1153 94

Chapter 23 Data Structures and Collections 1153 94 lock ( this ) 95 { 96 if ( IsEmpty() ) 97 firstNode = lastNode = 98 new ListNode( insertItem ); 99 100 else 101 lastNode = lastNode.Next = 102 new ListNode( insertItem ); 103 } 104 } 105 106 // remove first node from List 107 public object RemoveFromFront() 108 { 109 lock ( this ) 110 { 111 if ( IsEmpty() ) 112 throw new EmptyListException( name ); 113 114 object removeItem = firstNode.Data; // retrieve data 115 116 // reset firstNode and lastNode references 117 if ( firstNode == lastNode ) 118 firstNode = lastNode = null; 119 120 else 121 firstNode = firstNode.Next; 122 123 return removeItem; // return removed data 124 } 125 } 126 127 // remove last node from List 128 public object RemoveFromBack() 129 { 130 lock ( this ) 131 { 132 if ( IsEmpty() ) 133 throw new EmptyListException( name ); 134 135 object removeItem = lastNode.Data; // retrieve data 136 137 // reset firstNode and lastNode references 138 if ( firstNode == lastNode ) 139 firstNode = lastNode = null; 140 141 else 142 { 143 ListNode current = firstNode; 144 Fig. 23.4 Fig. 23.4Fig. 23FiFi.4g. 23.4g.23.4Definitions of classes ListNode, Listand EmptyListException. (Part 3 of 5.)
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services

Leave a Reply