classlib: add CharSequence.isEmpty support (#683)

This commit is contained in:
Ivan Hetman 2023-04-04 14:03:38 +03:00 committed by GitHub
parent 79df39fca0
commit 5dee60eec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -559,6 +559,11 @@ class TAbstractStringBuilder implements TSerializable, TCharSequence {
return buffer[index]; return buffer[index];
} }
@Override
public boolean isEmpty() {
return length == 0;
}
protected TAbstractStringBuilder append(TCharSequence s, int start, int end) { protected TAbstractStringBuilder append(TCharSequence s, int start, int end) {
return insert(length, s, start, end); return insert(length, s, start, end);
} }

View File

@ -20,6 +20,8 @@ public interface TCharSequence {
char charAt(int index); char charAt(int index);
boolean isEmpty();
TCharSequence subSequence(int start, int end); TCharSequence subSequence(int start, int end);
@Override @Override

View File

@ -151,6 +151,7 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
return characters.length; return characters.length;
} }
@Override
public boolean isEmpty() { public boolean isEmpty() {
return characters.length == 0; return characters.length == 0;
} }