java.lang.String
or CharSequence
.{@link Text} literals should be explicitly {@link #intern interned}. Unlike strings literals and strings-value constant expressions, interning is not implicit. For example:[code] final static Text TRUE = Text.intern("true"); final static Text FALSE = Text.intern("false"); [/code] Interned texts are always allocated in ImmortalMemory (RTSJ VMs).
{@link Text} instances can be {@link #println printed out} directly (no intermediate String
allocated). For example:[code] FastTable myTable ...; myTable.toText().println(); // Prints to System.out [/code]
Implementation Note: To avoid expensive copy operations , {@link Text} instances are broken down into smaller immutable sequences, they form a minimal-depth binary tree. The tree is maintained balanced automatically through tree rotations. Insertion/deletions are performed in O[Log(n)]
instead of O[n]
for StringBuffer/StringBuilder
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|