/**
 * An abstract class that implements IntSet and provides an implementation of toString 
 * that other implementing classes can use by subclassing this class.  (Since Java 8
 * default implementations can be provided by the interface instead.)
 */

public abstract class AbstractIntSet implements IntSet
{
    public String toString()
    {
	StringBuilder buf = new StringBuilder("[");
	for (int i = getRangeMin(); i <= getRangeMax(); i++)
	    {
		if (contains(i))
		    {
			if (buf.length() > 1)
			    {
				buf.append(", ");
			    }
			buf.append(i);
		    }
	    }
	buf.append("]");
	return buf.toString();
    }
}
