public static Collector<CharSequence, ?, String> commonSuffix() {
        return collectingAndThen(
            reducing((CharSequence s1, CharSequence s2) -> {
                if (s1 == null || s2 == null)
                    return "";

                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                int i;
                for (i = 0; i < l && s1.charAt(l1 - i - 1) == s2.charAt(l2 - i - 1); i++);

                return s1.subSequence(l1 - i, l1);
            }),
            s -> s.map(Objects::toString).orElse("")
        );
    }
Get a {@link Collector} that calculates the common suffix of a set of strings.
jOOL/src/main/java/org/jooq/lambda/Agg.java