public int compareTo(FileWrapper aOther) { if (aOther != null) { // Who says ternary is hard to follow if (isEnabled() == aOther.isEnabled()) { return (typeIndex == aOther.typeIndex) ? file.compareTo(aOther.file) : ((typeIndex < aOther.typeIndex) ? -1 : 1); } else { return isEnabled() ? -1 : 1; } } return -1; }