<div dir="auto">Since String is a locked down Class part of the standard library it cannot be modified nor subclassed(final).<div dir="auto">Also string directly has a lot of useful methods on hand that the more general CharSequence does not. </div><div dir="auto">This and the fact that CharSequence was only added in later versions (compared to string) causes many libraries to use the type string as arguments.</div><div dir="auto">This makes working with different implementations of text awkward and inefficient (since you often have to convert to string)</div><div dir="auto">There are multiple possible approaches to resolve this issue. </div><div dir="auto"><br></div><div dir="auto">One solution could be to add many of strings useful methods to CharSequence and implement them with default methods based on the existing abstract methods (or throw exception). These defaults could than be overridden by implementers that have more context to provide a more efficient implementation. </div><div dir="auto"><br></div><div dir="auto">Another approach could be to add a new interface that mirrors strings methods and is implemented by string decoupling the method api of string from the fixed string class.</div><div dir="auto"><br></div><div dir="auto">An even more radical and most likely most difficult/breaking approach would be to make string itself an interface. This solution would have the upside that all existing libraries would suddenly accept the interface instead of the locked down class without migrating each library seperatly. The downsides would be that previous to this change all constructors would need to be made private and some code that either used the constructors or was dependant on the class file structure of string might break. Also string literals would need to be rerouted to create an instance of the then internal implementation of string instead. </div><div dir="auto"><br></div><div dir="auto">There sure are other possibilities but those 3 where those I came up with.</div><div dir="auto"><br></div><div dir="auto">They all achieve the same goal of allowing libraries to ask for something string like without specifying the explicit implementation (similar to the collections framework) this would allow seamless use of other implementations in libraries without them having to reimplement or work around existing methods from the string class.</div><div dir="auto"><br></div><div dir="auto">Great regards </div><div dir="auto">RedIODev </div></div>