About 1,450,000 results
Open links in new tab
  1. 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,

  2. Why would you use a StringBuilder method over a String in Java?

    Oct 14, 2021 · What are the benefits of using a StringBuilder method over a String? Why not just amend the content within a String? I understand that a StringBuilder is mutable, but if you …

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

    The StringBuilder class is mutable and unlike String, it allows you to modify the contents of the string without needing to create more String objects, which can be a performance gain when …

  4. java - String, StringBuffer, and StringBuilder - Stack Overflow

    The Java language provides special support for the string concatenation operator (+), and for conversion of other objects to strings. String concatenation is implemented through the …

  5. String concatenation in Java - when to use +, StringBuilder and …

    Jul 29, 2015 · When should we use + for concatenation of strings, when is StringBuilder preferred and When is it suitable to use concat. I've heard StringBuilder is preferable for concatenation …

  6. How to convert Java String to JSON Object - Stack Overflow

    Mar 21, 2015 · I am trying to convert a java string into json object. Here is the code:

  7. java - How to append a newline to StringBuilder - Stack Overflow

    Jan 26, 2013 · StringBuilder result = new StringBuilder(); result.append(someChar); Now I want to append a newline character to the StringBuilder. How can I do it?

  8. java - How to insert a character in a string at a certain position ...

    As mentioned in comments, a StringBuilder is probably a faster implementation than using a StringBuffer. As mentioned in the Java docs: This class provides an API compatible with …

  9. Java: String - add character n-times - Stack Overflow

    Dec 7, 2011 · Is there a simple way to add a character or another String n-times to an existing String? I couldn’t find anything in String, Stringbuilder, etc.

  10. How to swap String characters in Java? - Stack Overflow

    Jun 5, 2009 · How can I swap two characters in a String? For example, "abcde" will become "bacde".