var lexer1 = Lexer.from("([0-9]+)") .map(Integer::parseInt); var lexer2 = Lexer.from("([0-9]+\\.[0-9]*)") .map(Double::parseDouble); var lexer3 = lexer1.or(lexer2);
super String, ? extends T>> mappers) { if (regexes.size() != mappers.size()) { // implicit nullchecks throw new IllegalArgumentException("lists with different sizes"); } regexes.forEach(regex -> requireOneCaptureGroup(compile(regex))); return new FastLexer<>(List.copyOf(regexes), List.copyOf(mappers)); }