package sets;
import java.util.Collections;
import lipstone.joshua.parser.Parser;
import lipstone.joshua.parser.exceptions.ParserException;
import lipstone.joshua.parser.util.LengthComparison;
public class StringSet extends Set<String> {
/**
* Constructs a new <tt>StringSet</tt> from a comma-separated list of items
*
* @param list
* the comma-separated list
* @throws ParserException
*/
public StringSet(String list) throws ParserException {
this.set.addAll(Parser.fromCommaList(list));
}
/**
* Sorts this set by length
*/
public void sortByLength() {
Collections.sort(set, new LengthComparison());
}
/**
* Sorts this set using Java's standard <tt>String</tt> comparisons
*/
public void sort() {
Collections.sort(set);
}
}