public static <T1, T2, T3, T4 extends Comparable<T4>> Comparator<T1> getNullSafeComparator(
            final Function<T1, T2> extractor1,
            final Function<T2, T3> extractor2,
            final Function<T3, T4> extractor3,
            final Comparator<T4> comparator) {

        // Sort with nulls first but also handle deps with null intermediate values
        return Comparator.comparing(
                extractor1,
                Comparator.nullsFirst(
                        Comparator.comparing(
                                extractor2,
                                Comparator.nullsFirst(
                                        Comparator.comparing(
                                                extractor3,
                                                Comparator.nullsFirst(comparator))))));
    }
Creates a null safe case insensitive comparator that can work with stuff like
getDocRef().getName().substring(1,3)
stroom-util-shared/src/main/java/stroom/util/shared/CompareUtil.java