diff options
-rw-r--r-- | poi/src/main/java/org/apache/poi/util/CodepointsUtil.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/util/CodepointsUtil.java b/poi/src/main/java/org/apache/poi/util/CodepointsUtil.java index b74cf8a88c..732af2e3ff 100644 --- a/poi/src/main/java/org/apache/poi/util/CodepointsUtil.java +++ b/poi/src/main/java/org/apache/poi/util/CodepointsUtil.java @@ -29,9 +29,18 @@ public class CodepointsUtil { * @see #primitiveIterator(String) a more performant iterator */ public static Iterator<String> iteratorFor(String text) { - return text.codePoints() - .mapToObj(codePoint -> new String(Character.toChars(codePoint))) - .iterator(); + final PrimitiveIterator.OfInt iter = primitiveIterator(text); + return new Iterator<String>() { + @Override + public boolean hasNext() { + return iter.hasNext(); + } + + @Override + public String next() { + return new String(Character.toChars(iter.nextInt())); + } + }; } /** |