uschindler commented on code in PR #14384:
URL: https://github.com/apache/lucene/pull/14384#discussion_r2008497905


##########
lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java:
##########
@@ -759,23 +759,14 @@ private Automaton toAutomaton(
    * @return the original codepoint and the set of alternates
    */
   private int[] toCaseInsensitiveChar(int codepoint) {
-    int[] altCodepoints = CaseFolding.lookupAlternates(codepoint);
-    if (altCodepoints != null) {
-      int[] concat = new int[altCodepoints.length + 1];
-      System.arraycopy(altCodepoints, 0, concat, 0, altCodepoints.length);
-      concat[altCodepoints.length] = codepoint;
-      return concat;
-    } else {
-      int altCase =
-          Character.isLowerCase(codepoint)
-              ? Character.toUpperCase(codepoint)
-              : Character.toLowerCase(codepoint);
-      if (altCase != codepoint) {
-        return new int[] {altCase, codepoint};
-      } else {
-        return new int[] {codepoint};
-      }
-    }
+    List<Integer> list = new ArrayList<>();
+    CaseFolding.expand(
+        codepoint,
+        (int variant) -> {

Review Comment:
   wouldn't have `list::add` as method reference not have worked?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to