Computer Science 252
Problem Solving with Java
Fall 2014, The College of Saint Rose
Lecture 21: ArrayList Practice
Date: Thursday, November 13, 2014
Agenda
- Announcements
- Lecture 20 assignment recap
- A bit more on the ArrayList examples
- In-class Exercise 21 - (5 lecture assignment
points) due before the end of class.
Modify the MovingFlags example to use enhanced for loops
(i.e., the "for each loops) wherever possible.
Please submit the Java files you modify in
Submission Box
under "InClass21" before you leave class.
- Lab 9: Simon in-class work time
Lecture 21 Assignment
Due at the start of class, Tuesday, November 18.
Please submit answers to these questions
in Submission
Box under "LA21" or in hard copy by the
start of our next class. We will discuss these questions at the
start of class, so no late submissions are accepted. Please be sure
that your name is clearly indicated in all submissions.
- Write a method that takes an ArrayList of objects that
implement the Drawable2DInterface as its parameter (the
parameter will have type ArrayList<Drawable2DInterface>) and
returns the number of the objects in the array whose x-coordinates
are less than 200. (5 points)
- Write a method that takes an int and an ArrayList of
Integer as parameters and returns another ArrayList of
Integer that includes only those values from the original
ArrayList that are greater than the int parameter's
value. (5 points)