All pastes #820231 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-17 12:36 UTC
rendered paste body
  /**
   * 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<T> intersect(Set<T> set){
	int i = 0;
	while (i< this.size()){
		int j = 0;
		while (j< set.size()){
			if (this.get(i).equals(set.get(j))){
				this.remove(i);
				i--;
				}
			j++;
		}
		i++;
	}
	return this;
}