Difference between revisions of "Sequential Loops"

From CSE231 Wiki
Jump to navigation Jump to search
(Created page with "=For Each Loop= Many of the methods in this class are well served by using the for-each loop. <youtube>noZA84IaS90</youtube> =For Index Loop= The constructor should choose th...")
 
 
Line 9: Line 9:
  
 
=While Loop With Iterator=
 
=While Loop With Iterator=
The [[##remove.28key.29|remove]] method should choose a while loop combined with [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html#remove-- iterator.remove()]
+
Methods such as [https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html LinkedList] [https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html#remove(java.lang.Object) remove] should choose a while loop combined with [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html#remove-- iterator.remove()]
  
 
<youtube>a9swvAIA-mg</youtube>
 
<youtube>a9swvAIA-mg</youtube>

Latest revision as of 02:16, 20 November 2022

For Each Loop

Many of the methods in this class are well served by using the for-each loop.

For Index Loop

The constructor should choose the for index loop to do its required array initialization.

While Loop With Iterator

Methods such as LinkedList remove should choose a while loop combined with iterator.remove()