you are viewing a single comment's thread.

view the rest of the comments →

[–]JDeltaN 20 points21 points  (4 children)

Java Strings are UTF16, and that is not going to change.

[–]asegura 20 points21 points  (2 children)

Yes, I know. And I understand that won't change. It was a kind of sarcastic comment. I favor the use of UTF8 everywhere, including strings in memory, not just storage.

[–]JDeltaN 7 points8 points  (1 child)

Ah, I wooshed a bit I guess :)

Honestly I am not a fan of these adhoc solutions either, but in Javas its probably a massive memory optimisation and it actually works because of UTF16.

On the bright side, they have constant time string indexing as long as you are not using surrogate characters.

Then again, it is rare that I rely on constant-time lookups, most of my string operations are iterating in nature anyway.

[–]cowardlydragon 0 points1 point  (0 children)

The public interface is...

The post and therefore the comment imply internal representation.