diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TCharSequence.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TCharSequence.java index 11f4c705f..2e24aee75 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TCharSequence.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TCharSequence.java @@ -15,6 +15,10 @@ */ package org.teavm.classlib.java.lang; +import org.teavm.classlib.java.util.stream.TIntStream; +import org.teavm.classlib.java.util.stream.intimpl.TCharSequenceCharsStream; +import org.teavm.classlib.java.util.stream.intimpl.TCharSequenceCodePointsStream; + public interface TCharSequence { int length(); @@ -24,6 +28,14 @@ public interface TCharSequence { TCharSequence subSequence(int start, int end); + default TIntStream chars() { + return new TCharSequenceCharsStream(this); + } + + default TIntStream codePoints() { + return new TCharSequenceCodePointsStream(this); + } + @Override String toString(); } diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java index 7e368cb20..6488165fb 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java @@ -33,6 +33,7 @@ import org.teavm.classlib.java.util.TLocale; import org.teavm.classlib.java.util.regex.TPattern; import org.teavm.classlib.java.util.stream.TIntStream; import org.teavm.classlib.java.util.stream.intimpl.TStringCharsStream; +import org.teavm.classlib.java.util.stream.intimpl.TStringCodePointsStream; import org.teavm.dependency.PluggableDependency; import org.teavm.interop.NoSideEffects; @@ -589,10 +590,16 @@ public class TString extends TObject implements TSerializable, TComparable