Nothing earth-shattering, but I made the list of packages and clusters sorted, which makes it a lot easier to find things. And, to make that less necessary, I implemented recursive removal of packages: if you remove a package, it removes anything that depends on that package as well, keeping the package dependency graph self-consistent.
There are various ways to make sorting work, and I had put together a couple of Comparator classes before doing it properly. The proper way is just to
implement Comparablein the classes that need sorting. And in most cases the actual comparison is trivial - we're just comparing the name, which is just a String. (For patches it's a 2-stage numerical comparison of the patch id and revision, but still simple.)
Once Comparable is implemented, then all I need to do is replace
TreeSetand everything sorts. Simple, obvious, and something I should have done much earlier.
Of course, there's no point in learning something like this and then only using it the once. So there's a new version of JKstat in which the
implements Comparable, which immediately gets the output from some of the JKstat demos sorted. (And sorted correctly - there is a specific Comparator in use here, to sort names like sd0 which contain numbers correctly: the numerical part is sorted separately and as a number, so that sd2 comes before sd10.)