SYSC 2100 Lecture Notes - Lecture 7: Iterator, Foreach Loop, Random Access

78 views3 pages

Document Summary

Both hierarchies have an interface at the top, abstract classes in between, and a fully defined class at the bottom. Classes that have undefined methods (like an interface) as well as defined methods (like a regular class) An abstract class, unlike an interface, provides simple definitions of methods that need not be overridden in the fully defined subclass. The benefit is that a subclass of abstractcollection need not override isempty() The collection interface includes method headings for inserting, removing and searching for an element in a collection. An iterator is an object that allows a user to loop through a collection without accessing the fields. Associated with each class that implements the collection interface, there is an iterator class that implements the following interface: - 2 // returns true if this iterator object is positioned. 6 // returns the element this iterator object is. 7 //positioned at, and advances this iterator object.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents