/** * Intersect takes all elements from list b that appears in * list a and removes them from list a and returns the * manipulated list a. * * @param set The list of items you want to remove * @return the manipulated list * @require this.size() != 0 * @require set.size() != 0 */ @Override public Set intersect(Set set){ Set isSet = this; for (int i=0; i< this.size(); i++){ for (int j=0; j< set.size(); j++){ if (this.get(i).equals(set.get(j))){ isSet.remove(i); i--; } } } return this; }