From 5dee60eec6b22306228b49990c33491bf7e03dfb Mon Sep 17 00:00:00 2001 From: Ivan Hetman Date: Tue, 4 Apr 2023 14:03:38 +0300 Subject: [PATCH] classlib: add CharSequence.isEmpty support (#683) --- .../org/teavm/classlib/java/lang/TAbstractStringBuilder.java | 5 +++++ .../java/org/teavm/classlib/java/lang/TCharSequence.java | 2 ++ .../src/main/java/org/teavm/classlib/java/lang/TString.java | 1 + 3 files changed, 8 insertions(+) diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java index a7cf112bc..4cafae5d4 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java @@ -559,6 +559,11 @@ class TAbstractStringBuilder implements TSerializable, TCharSequence { return buffer[index]; } + @Override + public boolean isEmpty() { + return length == 0; + } + protected TAbstractStringBuilder append(TCharSequence s, int start, int end) { return insert(length, s, start, end); } 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 9c650a4ab..11f4c705f 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 @@ -20,6 +20,8 @@ public interface TCharSequence { char charAt(int index); + boolean isEmpty(); + TCharSequence subSequence(int start, int end); @Override 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 4332247b5..13dee3c2a 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 @@ -151,6 +151,7 @@ public class TString extends TObject implements TSerializable, TComparable