use StringBuilder instead of StringBuffer when can (#1980)

pull/2004/head
XenoAmess 3 years ago committed by GitHub
parent ad806616f0
commit cbc6402035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -212,7 +212,7 @@ public class ReflectUtils {
while ((index = className.indexOf("[]", index) + 1) > 0) {
dimensions++;
}
StringBuffer brackets = new StringBuffer(className.length() - dimensions);
StringBuilder brackets = new StringBuilder(className.length() - dimensions);
for (int i = 0; i < dimensions; i++) {
brackets.append('[');
}

@ -83,7 +83,7 @@ public class NetUtils {
int responseCode = con.getResponseCode();
br = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line);
@ -138,7 +138,7 @@ public class NetUtils {
pw.flush();
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
String line = null;
boolean start = false;
while ((line = br.readLine()) != null) {

@ -689,7 +689,7 @@ public abstract class StringUtils {
}
int arraySize = array.length;
int bufSize = (arraySize == 0 ? 0 : (array[0].toString().length() + separator.length()) * arraySize);
StringBuffer buf = new StringBuffer(bufSize);
StringBuilder buf = new StringBuilder(bufSize);
for (int i = 0; i < arraySize; i++) {
if (i > 0) {

Loading…
Cancel
Save