About 124,000 results
Open links in new tab
  1. java - String, StringBuffer, and StringBuilder - Stack Overflow

    If your string can change (example: lots of logic and operations in the construction of the string) and will only be accessed from a single thread, using a StringBuilder is good enough. If your string can …

  2. java - Difference between StringBuilder and StringBuffer - Stack Overflow

    Dec 10, 2008 · What is the main difference between StringBuffer and StringBuilder? Is there any performance issues when deciding on any one of these?

  3. java - Performance and simplicity tradeoffs between String ...

    Mar 26, 2011 · String s1 = new StringBuilder(s2).append(s3).toString(); If you don't believe me, try it yourself with a disassembler (javap -c, for example.) The thing about "StringBuffer is faster than …

  4. Why is StringBuilder much faster than String? - Stack Overflow

    Mar 16, 2014 · 15 Why is StringBuilder much faster than string concatenation using the + operator? Even though that the + operator internally is implemented using either StringBuffer or StringBuilder.

  5. java - Where to use StringBuffer/StringBuilder than String - Stack …

    Jun 30, 2012 · The main idea is that String is immutable. So when you are trying to modify it, new object created. StringBuffer and StringBuilder are mutable. And the difference is the first one is thread-safe. …

  6. java - Why StringBuilder when there is String? - Stack Overflow

    String d = new StringBuilder(a).append(b).append(c).toString(); Note also that there is StringBuffer in addition to StringBuilder. The difference is that the former has synchronized methods. If you use it as …

  7. java - StringBuilder/StringBuffer vs. "+" Operator - Stack Overflow

    Using String concatenation is translated into StringBuilder operations by the compiler. To see how the compiler is doing I'll take a sample class, compile it and decompile it with jad to see what's the …

  8. Why to use StringBuffer in Java instead of the string concatenation ...

    Using StringBuffer (or StringBuilder in Java 5/6), is faster because it uses an internal array of chars to store the string, and when you use one of its add (...) methods, it doesn't create a new String object.

  9. string - When to use StringBuilder in Java - Stack Overflow

    It is supposed to be generally preferable to use a StringBuilder for string concatenation in Java. Is this always the case? What I mean is this: Is the overhead of creating a StringBuilder object,

  10. java - StringBuffer vs StringBuilder Vs StringTokenizer - Stack Overflow

    Jun 20, 2020 · StringBuffer serves same purpose as StringBuilder except that StringBuffer is thread-safe. StringTokenizer is used for splitting the string into tokens based on some delimiters.