The next few exercises you will declare a Set class that uses an ArrayList as the implementation data structure. The new class is named ...
X1362: ArrayListSet - Constructor
The next few exercises you will declare a Set class
that uses an ArrayList as the implementation data
structure. The new class is named ArrayListSet and it
is partially defined for you.
In this exercise, you will do three things.
you will declare the instance variable named
setof typeArrayList<E>. YOU MUST use the name set for this instance variable.In the constructor, instantiate the set by creating a new
ArrayList<E>.The
clear()method should just (re)create a new set as a way to initialize it.
You can assume the class definition, as shown below, is already there for you:
import itsc2214.*;
public class ArrayListSet<E> implements SetADT<E> {
// code for the exercises goes here
}
You might want to look at the documentation for
ArrayList
to refresh your memory of how to use that class.
Your Answer:
Feedback
Your feedback will appear here when you check your answer.