Use StringBuilders instead of StringBuffers
(A couple of instances were overlooked) This fixes #236
This commit is contained in:
parent
ce1bd5785d
commit
30c85ad053
|
@ -380,7 +380,7 @@ public class RandomStringUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer buffer = new StringBuffer(count);
|
StringBuilder builder = new StringBuilder(count);
|
||||||
final int gap = end - start;
|
final int gap = end - start;
|
||||||
|
|
||||||
while (count-- != 0) {
|
while (count-- != 0) {
|
||||||
|
@ -409,7 +409,7 @@ public class RandomStringUtils {
|
||||||
if (letters && Character.isLetter(codePoint)
|
if (letters && Character.isLetter(codePoint)
|
||||||
|| numbers && Character.isDigit(codePoint)
|
|| numbers && Character.isDigit(codePoint)
|
||||||
|| !letters && !numbers) {
|
|| !letters && !numbers) {
|
||||||
buffer.appendCodePoint(codePoint);
|
builder.appendCodePoint(codePoint);
|
||||||
|
|
||||||
if (numberOfChars == 2) {
|
if (numberOfChars == 2) {
|
||||||
count--;
|
count--;
|
||||||
|
@ -419,7 +419,7 @@ public class RandomStringUtils {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -280,8 +280,8 @@ public class ArrayUtilsTest {
|
||||||
assertTrue(Arrays.equals(original1, cloned1));
|
assertTrue(Arrays.equals(original1, cloned1));
|
||||||
assertTrue(original1 != cloned1);
|
assertTrue(original1 != cloned1);
|
||||||
|
|
||||||
final StringBuffer buf = new StringBuffer("pick");
|
final StringBuilder builder = new StringBuilder("pick");
|
||||||
original1 = new Object[] {buf, "a", new String[] {"stick"}};
|
original1 = new Object[] {builder, "a", new String[] {"stick"}};
|
||||||
cloned1 = ArrayUtils.clone(original1);
|
cloned1 = ArrayUtils.clone(original1);
|
||||||
assertTrue(Arrays.equals(original1, cloned1));
|
assertTrue(Arrays.equals(original1, cloned1));
|
||||||
assertTrue(original1 != cloned1);
|
assertTrue(original1 != cloned1);
|
||||||
|
|
Loading…
Reference in New Issue