package stexfires.core.comparator;

import stexfires.util.StringUnaryOperatorType;

import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
import java.util.Objects;
import java.util.function.UnaryOperator;

import static java.util.Comparator.comparing;

/**
 * This class consists of {@code static} utility methods
 * for constructing comparators for {@link String} values.
 *
 * @author Mathias Kalb
 * @see java.util.Comparator
 * @see java.text.Collator
 * @see stexfires.util.StringUnaryOperatorType
 * @since 0.1
 */
public final class StringComparators {

    private StringComparators() {
    }

    public static Comparator<String> compareTo() {
        return String::compareTo;
    }

    public static Comparator<String> compareToIgnoreCase() {
        // String.CASE_INSENSITIVE_ORDER
        return String::compareToIgnoreCase;
    }

    public static Comparator<String> collatorComparator(Collator collator) {
        Objects.requireNonNull(collator);
        return collator::compare;
    }

    public static Comparator<String> collatorComparator(Locale locale) {
        Objects.requireNonNull(locale);
        Collator collator = Collator.getInstance(locale);
        return collator::compare;
    }

    public static Comparator<String> collatorComparator(Locale locale,
                                                        int collatorStrength) {
        Objects.requireNonNull(locale);
        Collator collator = Collator.getInstance(locale);
        collator.setStrength(collatorStrength);
        return collator::compare;
    }

    public static Comparator<String> normalizedComparator(UnaryOperator<String> normalizeFunction,
                                                          Comparator<String> comparator) {
        Objects.requireNonNull(normalizeFunction);
        Objects.requireNonNull(comparator);
        return comparing(normalizeFunction, comparator);
    }

    public static Comparator<String> normalizedComparator(StringUnaryOperatorType stringUnaryOperatorType,
                                                          Comparator<String> comparator) {
        Objects.requireNonNull(stringUnaryOperatorType);
        Objects.requireNonNull(comparator);
        return comparing(stringUnaryOperatorType.stringUnaryOperator(), comparator);
    }

}

@@ -21,32 +21,75 @@
 re.comparator;%0A%0A
+import org.jetbrains.annotations.Nullable;%0A
 import stexfires
@@ -2360,10 +2360,490 @@
 %0A    %7D%0A%0A
+    public static Comparator%3CString%3E normalizedComparator(StringUnaryOperatorType stringUnaryOperatorType,%0A                                                          @Nullable Locale locale,%0A                                                          Comparator%3CString%3E comparator) %7B%0A        Objects.requireNonNull(stringUnaryOperatorType);%0A        Objects.requireNonNull(comparator);%0A        return comparing(stringUnaryOperatorType.stringUnaryOperator(locale), comparator);%0A    %7D%0A%0A
 %7D%0A

Add new method with additional 'Locale' parameter