Как упростить нулевую безопасную реализацию compareTo()?

Использование Java 8:

private static Comparator nullSafeStringComparator = Comparator
        .nullsFirst(String::compareToIgnoreCase); 

private static Comparator metadataComparator = Comparator
        .comparing(Metadata::getName, nullSafeStringComparator)
        .thenComparing(Metadata::getValue, nullSafeStringComparator);

public int compareTo(Metadata that) {
    return metadataComparator.compare(this, that);
}

j2se

java

refactoring

comparison

null

compareto

2022-10-29T15:03:14+00:00