diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java index 5ac53c3be..f4cdfdd41 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TString.java @@ -19,6 +19,9 @@ import org.teavm.classlib.impl.charset.*; import org.teavm.classlib.java.io.TSerializable; import org.teavm.classlib.java.io.TUnsupportedEncodingException; import org.teavm.classlib.java.util.TArrays; +import org.teavm.classlib.java.util.TComparator; +import org.teavm.classlib.java.util.THashMap; +import org.teavm.classlib.java.util.TMap; import org.teavm.dependency.PluggableDependency; import org.teavm.javascript.ni.InjectedBy; import org.teavm.javascript.ni.Rename; @@ -28,8 +31,14 @@ import org.teavm.javascript.ni.Rename; * @author Alexey Andreev */ public class TString extends TObject implements TSerializable, TComparable, TCharSequence { + public static final TComparator CASE_INSENSITIVE_ORDER = new TComparator() { + @Override public int compare(TString o1, TString o2) { + return o1.compareToIgnoreCase(o2); + } + }; private char[] characters; private transient int hashCode; + private static TMap pool = new THashMap<>(); public TString() { this.characters = new char[0]; @@ -183,6 +192,21 @@ public class TString extends TObject implements TSerializable, TComparable length()) { return false; @@ -548,4 +572,32 @@ public class TString extends TObject implements TSerializable, TComparable