In this second problem, you will complete the add() method. This method adds an element to the end of the instance variable (set) you...
X1363: ArraySet - add()
In this second problem, you will complete the
add() method. This method adds an element to the
end of the instance variable (set) you created in the
previous problem. Worthy of note, a set does not allow
duplicates. So, your add() method should check if the
element is contained in the set already. If it is, then
don't add it and return false.
If it is not in the set already, then add it and return
true.
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.