int (NodeDescriptor nodeDescriptor1, NodeDescriptor nodeDescriptor2) { int weight1 = nodeDescriptor1.getWeight(); int weight2 = nodeDescriptor2.getWeight(); if (weight1 != weight2) { return weight1 - weight2; } String s1 = nodeDescriptor1.toString(); String s2 = nodeDescriptor2.toString(); if (s1 == null) return s2 == null ? 0 : -1; if (s2 == null) return +1; return FileNameComparator.INSTANCE.compare(s1, s2); }