
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Object-Oriented Software Dvlpm; Subject: Computer Sci & Software Engr; University: Rose-Hulman Institute of Technology; Term: Unknown 1989;
Typology: Study notes
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















^ Reminder: Exam #2 is (next) Friday, May 2.^ In order to reduce time pressure, youoptionally may take the non-programming part7:15-8:00 AM. ^ Markov repositories:^ ◦^ http://svn.cs.rose-hulman.edu/repos/220-200820-markovXXX^ Questions? `^ Today:^ ◦^ Java Collections^ ◦^ Iterators^ ◦^ Begin implementing listsFactory method
i^ <^ ar.length;^ i++)
{
Example: Using an Iterator^ ag^ is a Collection object.^ Using Java 1.5’s “foreach” construct: Note that the Java compiler essentially translates the latter code into the former.
What's an iterator? ` More specifically, what is a j
ava.util.Iterator
? ◦^ It's an interface: ◦^ interface^ java.util.Iterator
class provides static methods for sorting and doing binary search on arrays.Examples:
ag can be any^ Collection
of^ Integers In Java 1.5 we can simplify it even more. Note that the Java compiler translates the latter code into the former.
^ addAll – add all of the elements from anothercollection to this one^ containsAll – does this collection contain all ofthe elements of the other collection? ^ removeAll – removes all of this collectionselements that are also contained in the othercollection^ retainAll - removes all of this collectionselements that are not contained in the othercollection `^ toArray – returns an array that contains the sameelements as this collection.
^ In weiss.util, the author shows "bare bones"possible implementations of some of theclasses in java.util.^ He picks the methods that illustrate theessence of what is involved in theimplementation, for educational purposes. `^ Some other Data Structures classes are inweiss.nonstandard.