package common;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * <p>A utility class providing certain set-manipulation tools, in the form of instance methods,
 * that some sets used in the sudoku target-solving techniques provided in this package.</p>
 * @author fiveham
 * @author fiveham
 *
 * @param <T>
 * @param <T>@param <T>
 */
public class ToolSet<T> extends HashSet<T> {
	
	private static final long serialVersionUID = 7562530465837262993L;
	
  /**
   * <p>Constructs an empty ToolSet.</p>
   */
	protected ToolSet() {
	}
	
  /**
   * <p>Constructs a ToolSet containing all the elements of {@code c}.</p>
   * @param c the collection whose elements will be contained by this ToolSet
   */
	private ToolSet(Collection<? extends T> c) {
		super(c);
	}
	
  /**
   * <p>Constructs an empty ToolSet whose capacity is initially set to {@code initialCapacity}.</p>
   * @param initialCapacity the initial capacity of this ToolSet
   */
	protected ToolSet(int initialCapacity) {
		super(initialCapacity);
	}
	
	public ToolSet<T> intersection(Collection<? extends T> otherSet){
		ToolSet<T> result = new ToolSet<>(this);
		result.retainAll(otherSet);
		return result;
	}
	
    /**
     * <p>Returns a list of elements from this set not found in {@code otherCollection}.</p>
     * @param otherCollection
     * @return
     */
	public List<T> complement(Collection<T> otherCollection){
		return stream().filter((e)->!otherCollection.contains(e)).collect(Collectors.toList());
	}
	
    /**
     * <p>Returns true if {@code otherSet} is a proper subset of {@code this}, false otherwise.</p>
     * @param otherSet another set
     * @return true if {@code otherSet} is a proper subset of {@code this}, false otherwise
     */
	public boolean hasProperSubset(Set<T> otherSet){
		return size() > otherSet.size() && containsAll(otherSet);
	}
	
    /**
     * <p>Returns true if {@code otherSet} is a subset of {@code this}, false otherwise.</p>
     * @param otherSet another set
     * @return true if {@code otherSet} is a proper subset of {@code this}, false otherwise
     */
	public boolean hasSubset(Set<T> otherSet){
		return size() >= otherSet.size() && containsAll(otherSet);
	}
}

@@ -31,125 +31,15 @@
 til.
-Collection;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.stream.Collectors
+HashSet
 ;%0A%0A/
@@ -542,1626 +542,224 @@
 ts a
- ToolSet containing all the elements of %7B@code c%7D.%3C/p%3E%0A   * @param c the collection whose elements will be contained by this ToolSet%0A   */%0A%09private ToolSet(Collection%3C? extends T%3E c) %7B%0A%09%09super(c);%0A%09%7D%0A%09%0A  /**%0A   * %3Cp%3EConstructs an empty ToolSet whose capacity is initially set to %7B@code initialCapacity%7D.%3C/p%3E%0A   * @param initialCapacity the initial capacity of this ToolSet%0A   */%0A%09protected ToolSet(int initialCapacity) %7B%0A%09%09super(initialCapacity);%0A%09%7D%0A%09%0A%09public ToolSet%3CT%3E intersection(Collection%3C? extends T%3E otherSet)%7B%0A%09%09ToolSet%3CT%3E result = new ToolSet%3C%3E(this);%0A%09%09result.retainAll(otherSet);%0A%09%09return result;%0A%09%7D%0A%09%0A    /**%0A     * %3Cp%3EReturns a list of elements from this set not found in %7B@code otherCollection%7D.%3C/p%3E%0A     * @param otherCollection%0A     * @return%0A     */%0A%09public List%3CT%3E complement(Collection%3CT%3E otherCollection)%7B%0A%09%09return stream().filter((e)-%3E!otherCollection.contains(e)).collect(Collectors.toList());%0A%09%7D%0A%09%0A    /**%0A     * %3Cp%3EReturns true if %7B@code otherSet%7D is a proper subset of %7B@code this%7D, false otherwise.%3C/p%3E%0A     * @param otherSet another set%0A     * @return true if %7B@code otherSet%7D is a proper subset of %7B@code this%7D, false otherwise%0A     */%0A%09public boolean hasProperSubset(Set%3CT%3E otherSet)%7B%0A%09%09return size() %3E otherSet.size() && containsAll(otherSet);%0A%09%7D%0A%09%0A    /**%0A     * %3Cp%3EReturns true if %7B@code otherSet%7D is a subset of %7B@code this%7D, false otherwise.%3C/p%3E%0A     * @param otherSet another set%0A     * @return true if %7B@code otherSet%7D is a proper subset of %7B@code this%7D, false otherwise%0A     */%0A%09public boolean hasSubset(Set%3CT%3E otherSet)%7B%0A%09%09return size() %3E= otherSet.size() && containsAll(otherSet
+n empty ToolSet whose capacity is initially set to %7B@code initialCapacity%7D.%3C/p%3E%0A   * @param initialCapacity the initial capacity of this ToolSet%0A   */%0A%09protected ToolSet(int initialCapacity) %7B%0A%09%09super(initialCapacity
 );%0A%09

remove unused methods