Use StringBuilders instead of StringBuffers

(A couple of instances were overlooked)
This fixes #236
This commit is contained in:
Sebb 2017-02-16 18:59:01 +00:00
parent ce1bd5785d
commit 30c85ad053
2 changed files with 5 additions and 5 deletions

View File

@ -380,7 +380,7 @@ public class RandomStringUtils {
}
}
StringBuffer buffer = new StringBuffer(count);
StringBuilder builder = new StringBuilder(count);
final int gap = end - start;
while (count-- != 0) {
@ -409,7 +409,7 @@ public class RandomStringUtils {
if (letters && Character.isLetter(codePoint)
|| numbers && Character.isDigit(codePoint)
|| !letters && !numbers) {
buffer.appendCodePoint(codePoint);
builder.appendCodePoint(codePoint);
if (numberOfChars == 2) {
count--;
@ -419,7 +419,7 @@ public class RandomStringUtils {
count++;
}
}
return buffer.toString();
return builder.toString();
}

View File

@ -280,8 +280,8 @@ public class ArrayUtilsTest {
assertTrue(Arrays.equals(original1, cloned1));
assertTrue(original1 != cloned1);
final StringBuffer buf = new StringBuffer("pick");
original1 = new Object[] {buf, "a", new String[] {"stick"}};
final StringBuilder builder = new StringBuilder("pick");
original1 = new Object[] {builder, "a", new String[] {"stick"}};
cloned1 = ArrayUtils.clone(original1);
assertTrue(Arrays.equals(original1, cloned1));
assertTrue(original1 != cloned1);