static Matcher convertSingleCharClassToSeq(Matcher matcher) {
    if (matcher instanceof CharClassMatcher) {
      Optional<Character> opt = matcher.<CharClassMatcher>as().set().character();
      if (opt.isPresent()) {
        return new CharSeqMatcher(opt.get());
      }
    }
    return matcher;
  }
static Matcher convertSingleCharClassToSeq ( Matcher matcher ) { if ( matcher instanceof CharClassMatcher ) { Optional < Character > opt = matcher . < CharClassMatcher > as ( ) . set ( ) . character ( ) ; if ( opt . isPresent ( ) ) { return new CharSeqMatcher ( opt . get ( ) ) ; } } return matcher ; }
If a character class has a single value, then just match that value ({@code "[a]" => "a"}).
This allows other optimizations to merge the value into adjacent matchers to get a larger
prefix or indexOf check.