Interface Replacement<R>

Type Parameters:
R - the type of the replaced value
All Superinterfaces:
BiFunction<R,Integer,R>
All Known Subinterfaces:
RelativeDateReplacement, RelativeDateTimeReplacement

public interface Replacement<R> extends BiFunction<R,Integer,R>
A BiFunction, that defines how a match is replaced.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable R
    apply(R match, Integer count)
    Will return a replacement for the given match and count.

    Methods inherited from interface java.util.function.BiFunction

    andThen
  • Method Details

    • apply

      @Nullable R apply(R match, Integer count)
      Will return a replacement for the given match and count.

      The count will be the same for equal matches. E.g. if all vowels ([aeiou]) should be replaced in the text Hello there, this will be applied four times:

      1. He
        apply("e", 1),
      2. Hello
        apply("o", 2),
      3. Hello the
        apply("e", 1),
      4. Hello there
        apply("e", 1)
      Specified by:
      apply in interface BiFunction<R,Integer,R>
      Parameters:
      match - the found string that will be replaced
      count - the number of the distinct match
      Returns:
      the replacement