]> source.dussan.org Git - jgit.git/commitdiff
Using StringBuilder in StringUtils#capitalize method 05/154705/2
authorLars Vogel <Lars.Vogel@vogella.com>
Tue, 17 Dec 2019 22:51:00 +0000 (23:51 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 17 Dec 2019 23:18:41 +0000 (00:18 +0100)
StringBuffer is synchronized which is slower and should be replaced with
StringBuilder according to its Javadoc.

Change-Id: If4d4a5a49da289ded34bbec97132ab7636b937cc
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java

index 7e8bbc80f8f39a4320f6e5b46c56f4eccb985265..b2e3446089a5a452eb366265b65436ff9654a888 100644 (file)
@@ -121,7 +121,7 @@ public final class StringUtils {
                if (str == null || (strLen = str.length()) == 0) {
                        return str;
                }
-               return new StringBuffer(strLen)
+               return new StringBuilder(strLen)
                                .append(Character.toTitleCase(str.charAt(0)))
                                .append(str.substring(1)).toString();
        }