class FieldComparators extends FieldHolder<Comparator<?>> {

  protected final LinkedList<ComparatorForPatterns> comparatorByPatterns = new LinkedList<>();

  /**
   * Registers the {@code comparator} for the given {@code fieldLocation}.
   *
   * @param fieldLocation the location where to apply the comparator
   * @param comparator the comparator itself
   */
  public void registerComparator(String fieldLocation, Comparator<?> comparator) {
    super.put(fieldLocation, comparator);
  }

  /**
   * Registers the {@code comparator} for the given regexes field location.
   *
   * @param regexes the regexes field location where to apply the comparator
   * @param comparator the comparator to use for the regexes
   */
  public void registerComparatorForFieldsMatchingRegexes(String[] regexes, Comparator<?> comparator) {
    List<Pattern> patterns = Stream.of(regexes).map(Pattern::compile).collect(toList());
    comparatorByPatterns.addFirst(new ComparatorForPatterns(patterns, comparator));
  }

  /**
   * Checks, whether an any comparator is associated with the giving field location.
   *
   * @param fieldLocation the field location which association need to check
   * @return is field location contain a custom comparator
   */
  public boolean hasComparatorForField(String fieldLocation) {
    // TODO sanitize here?
    boolean hasComparatorForExactFieldLocation = super.hasEntity(fieldLocation);
    // comparator for exact location takes precedence over the one with location matched by regexes
    if (hasComparatorForExactFieldLocation) return true;
    // no comparator for exact location, check if there is a regex that matches the field location
    return comparatorByPatterns.stream()
                               .anyMatch(comparatorForPatterns -> comparatorForPatterns.hasComparatorForField(fieldLocation));
  }

  /**
   * Retrieves a custom comparator, which is associated with the giving field location. If this location does not
   * associate with any custom comparators - this method returns null.
   *
   * @param fieldLocation the field location that has to be associated with a comparator
   * @return a custom comparator or null
   */
  public Comparator<?> getComparatorForField(String fieldLocation) {<FILL_FUNCTION_BODY>}

  /**
   * Returns a sequence of associated field-comparator pairs.
   *
   * @return sequence of field-comparator pairs
   */
  public Stream<Entry<String, Comparator<?>>> comparatorByFields() {
    return super.entryByField();
  }

  public Stream<Entry<List<Pattern>, Comparator<?>>> comparatorByRegexFields() {
    return comparatorByPatterns.stream().map(comparatorForPatterns -> entry(comparatorForPatterns.fieldPatterns,
                                                                            comparatorForPatterns.comparator));
  }

  @Override
  public boolean isEmpty() {
    return super.isEmpty() && comparatorByPatterns.isEmpty();
  }

  public boolean hasFieldComparators() {
    return !super.isEmpty();
  }

  public boolean hasRegexFieldComparators() {
    return !comparatorByPatterns.isEmpty();
  }
}

    Comparator<?> exactFieldLocationComparator = super.get(fieldLocation);
    if (exactFieldLocationComparator != null) return exactFieldLocationComparator;
    // no comparator for exact location, check if there is a regex that matches the field location
    return comparatorByPatterns.stream()
                               .map(comparatorForPatterns -> comparatorForPatterns.getComparatorForField(fieldLocation))
                               .filter(comparator -> comparator != null)
                               .findFirst()
                               .orElse(null);
  
<methods>public void <init>() ,public Stream<Entry<java.lang.String,Comparator<?>>> entryByField() ,public boolean equals(java.lang.Object) ,public Comparator<?> get(java.lang.String) ,public boolean hasEntity(java.lang.String) ,public int hashCode() ,public boolean isEmpty() ,public void put(java.lang.String, Comparator<?>) ,public java.lang.String toString() <variables>protected final non-sealed Map<java.lang.String,Comparator<?>> fieldHolder