About 59,100 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 - String, StringBuffer, and StringBuilder - Stack Overflow

    Jun 4, 2010 · StringBuilder is more efficient than StringBuffer. Situations: If your string is not going to change use a String class, because a String object is immutable. If your string can change …

  4. java - Difference between StringBuilder and StringBuffer - Stack …

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

  5. 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 …

  6. java - Why use StringBuilder explicitly if the compiler converts …

    Possible Duplicate: StringBuilder vs String concatenation in toString () in Java I am wondering, since the compiler internally uses a StringBuilder to append Strings when performing String …

  7. 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 …

  8. java - Is it better to reuse a StringBuilder in a loop? - Stack Overflow

    Use sb.setLength (0); instead, it's the fastest way to empty the contents of StringBuilder against recreating object or using .delete (). Note that this doesn't apply to StringBuffer, its …

  9. Java 8 Int Stream collect with StringBuilder - Stack Overflow

    Dec 4, 2016 · I have a function that creates an int stream, finds the distinct characters, sorts them and then collects them into a new list and then creates a string. Below is the function. public …

  10. StringBuilder vs String concatenation in toString () in Java

    The idea is to replace the entire StringBuilder append dance with a simple invokedynamic call to java.lang.invoke.StringConcatFactory, that will accept the values in the need of concatenation.

Refresh