Make "Command" class comparable
Brought to you by:
ferranb
As I wanted my commands to be sorted when printed with the "HelpCommand" I made the Command class comperable.
public class Command implements Comparable<Command> {
@Override
public int compareTo(Command cmd) {
return getSyntax().getDefinition().compareTo(cmd.getSyntax().getDefinition());
}
}
After that you can put your commands into a TreeSet which is sorted by default.