Complete this method in Java Create a new set that contains

Complete this method in Java

* Create a new set that contains all the elements from this set except those from the other set.
* @param set2
* the second set in the subtraction
* @precondition
* set2 is not null
* @postcondition
* the returned set is smaller than this set
* @return
* the subtraction of set2 from this set
* @exception NullPointerException
* Indicates that the argument is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new set.
*/
public IntSet minus(IntSet set2)
{
// If set2 is null, then a NullPointerException is thrown.


}

Solution

Please find below the completed method in Java :

Complete this method in Java * Create a new set that contains all the elements from this set except those from the other set. * @param set2 * the second set in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site