'Difference between a Java String UTF8 and String8?
What is difference between a String8(C++) and a String in Java ?
Solution 1:[1]
As far as I can tell:
Property java.lang.String android::String8
================================================================
language Java C++
Unicode yes yes
char width 16 8
encoding UTF-16 UTF-8
mutability immutable mutable
bunch of file path methods no yes
attitude to Darwin indifferent annoyed (line 47)
They are both Unicode string types; the similarities seem to end there.
Solution 2:[2]
The more important difference is Java String consumes aproximately twice the memory than String8 and other alternatives for the same text.
Also Java String is inmutable: so you cannot modify its contents and this have some good... and... some very bad implications (although you have StringBuilder and other alternatives).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | McDowell |
| Solution 2 | user1039663 |
