Complete the method in Java Remove from this set any of its
Complete the method in Java
* Remove from this set any of its elements that are not contained in another set.
* The result is this set intersected with the other set
* @param set2
* a set whose elements will be intersected with this set
* @precondition
* The parameter, set2, is not null.
* @postcondition
* This set contains the intersection of itself with set2.
* @exception NullPointerException
* Indicates that set2 is null.
*/
public void keepCommonElements(IntSet set2)
{
}
Solution
Please find the completed code for the given method :
