int (final @NotNull WeighingComparable<T,Loc> comparable) { if (myComputedWeighs == comparable.myComputedWeighs) return 0; for (int i = 0; i < myComputedWeighs.length; i++) { final Comparable weight1 = getWeight(i); final Comparable weight2 = comparable.getWeight(i); if (weight1 == null ^ weight2 == null) { return weight1 == null ? -1 : 1; } if (weight1 != null) { final int result = weight1.compareTo(weight2); if (result != 0) { return result; } } } myComputedWeighs = comparable.myComputedWeighs; return 0; }