MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / toString

Method toString

vm/JavaAPI/src/java/lang/StringBuilder.java:567–579  ·  view source on GitHub ↗

Converts to a string representing the data in this string builder. A new String object is allocated and initialized to contain the character sequence currently represented by this string builder. This String is then returned. Subsequent changes to the string builder do not affect the contents of the

()

Source from the content-addressed store, hash-verified

565 * Implementation advice: This method can be coded so as to create a new String object without allocating new memory to hold a copy of the character sequence. Instead, the string can share the memory used by the string builder. Any subsequent operation that alters the content or capacity of the string builder must then make a copy of the internal builder at that time. This strategy is effective for reducing the amount of memory allocated by a string concatenation operation when it is implemented using a string builder.
566 */
567 public java.lang.String toString(){
568 if (count == 0) {
569 return "";
570 }
571 // Optimize String sharing for more performance
572 /*int wasted = value.length - count;
573 if (wasted >= 256
574 || (wasted >= INITIAL_CAPACITY && wasted >= (count >> 1))) {
575 return new String(value, 0, count);
576 }
577 shared = true;*/
578 return new String(value, 0, count);
579 }
580
581
582 public void trimToSize() {

Callers 15

toJsonMethod · 0.95
TranscriptionResultMethod · 0.95
toSrtMethod · 0.95
toVttMethod · 0.95
toJsonMethod · 0.95
scrubEmailsMethod · 0.95
scrubDigitRunsMethod · 0.95
getTextMethod · 0.95
tileForMethod · 0.95
toHexMethod · 0.95
otpauthUriMethod · 0.95
padMethod · 0.95

Calls

no outgoing calls

Tested by 15

arrayToStringMethod · 0.76
slurpMethod · 0.76
jsonEscapeMethod · 0.76
summarizeMessagesMethod · 0.76
mainMethod · 0.76
describeArgsMethod · 0.76
runMavenCompileMethod · 0.76
javaMajorMethod · 0.76
runTestMethod · 0.76
buildPayloadMethod · 0.76
buildLegendMethod · 0.76
recordedSubmissionsMethod · 0.76