12.6 Exercises
Factual
What methods are required for a class that is Iterable?
Which of the following is true about the
java.util.Se
t and thejava.util.List
interfaces?Suppose we have a class that implements
Iterator
. What methods must it override in order to compile?
Conceptual
Why do we want to override the
.equals
method?
Metacognitive
In lecture, you built the
ArraySetIterator
class. Modify the lecture class to take in aComparator<T>
and an item of generic typeT
calledref
in the constructor. This new iterator should only return items greater thanT
. For reference, the code forArraySetIterator
is included below.
Problem 7 from the Spring 2018 Midterm 2
Last updated