CS 2114 Lecture Notes - Lecture 20: Mobile Suit Gundam, Github, Iterator

117 views3 pages

Document Summary

Lecture 20 iterators & generics ii & intro to sorted lists. Github workshop this week: wednesday, april 4 or thursday, april 5. Project v preliminary submission is due designs will be due monday, april 9; Project v final submission is due thursday, april 26. Project iv is due monday, april 16 (less than two weeks away). Can have multiple iterators (both moving size by side, different directions, etc. The enhanced for loop creates an iterator object and implicitly calls its hasnext and next methods: example: has an iterator inside. for (string nextstr : mylist) System. out. println(nextstr): example: has an iterator inside. public static double getaverageheight(iterable people) for (person person : people) { count++; totalheight += person. getheight(); Commonly want to perform some process on all objects. Performing some kind of update/change on each object. Lists have indices so we can use an index access all of the objects. If the underlying structure is a linked chain, this becomes (cid:4666)(cid:4667).

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents