In this assignment you will practice
You want a convenient collection class for Squares.
Write a SquareSet class that implements Set<Square>.
add method. For all other optional methods follow the instructions in the Set API documentation (what happens when a user calls an optional method that has not been implemented?).Collections interface documentation.InvalidSquareException you created in the previous homework. You may need to modify your InvalidSquareException class.null is added, throw a NullPointerException.Set<E> implements Iterable<E>. So you’ll also need to write a class that implements Iterator<Square>, an instance of which you should return from SquareSet’s iterator method. Your Iterator<Square> class should be an inner class.For each class include Javadoc comments as described in the CS 1331 style guide.
SquareSetSquareSet(Collection<Square>) contsructor creates an instance of SquareSet with no duplicates or nullsadd method adds a valid Square not already in the setadd method throws exceptoin for attempt to add and invalid Squareadd method does not add a valid Square already in the setcontainscontainsAllequalshashCodeisEmptyiteratorsizetoArraytoArray(T[] a)Bonus:
addAll adds all Squares in argument if all squares are validaddAll throws InvalidSquareExceptoin and adds no Squares from argument if any Square in argument is invalidaddAll adds Squares from arguemnt that are not already in set but not any Square’s that are already in the setremove removes argument from setCheckstyle deduction will be capped at 50 points for this homework.
Submit each of your Java source files on T-Square as separate attachments. When you’re ready, double-check that you have submitted and not just saved a draft.
Practice safe submission! Verify that your HW files were truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.
This procedure helps guard against a few things.