Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ public static <K, V, T> Map<T, Map<K, V>> groupBy(Map<K, V> receiver, BiFunction
public static String replaceAll(CharSequence receiver, Pattern pattern, Function<Matcher, String> replacementBuilder) {
Matcher m = pattern.matcher(receiver);
if (false == m.find()) {
// CharSequqence's toString is *supposed* to always return the characters in the sequence as a String
// CharSequence's toString is *supposed* to always return the characters in the sequence as a String
return receiver.toString();
}
StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver));
StringBuilder result = new StringBuilder(initialBufferForReplaceWith(receiver));
do {
m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m)));
} while (m.find());
Expand All @@ -477,7 +477,7 @@ public static String replaceFirst(CharSequence receiver, Pattern pattern, Functi
// CharSequqence's toString is *supposed* to always return the characters in the sequence as a String
return receiver.toString();
}
StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver));
StringBuilder result = new StringBuilder(initialBufferForReplaceWith(receiver));
m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m)));
m.appendTail(result);
return result.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Object getValue(String key) throws IOException {
* modern versions of java the uncontended synchronization is very,
* very cheap so that should not be a problem.
*/
StringBuffer result = new StringBuffer(key.length());
StringBuilder result = new StringBuilder(key.length());
if (false == matcher.find()) {
throw new IllegalArgumentException("Doesn't contain any stash keys [" + key + "]");
}
Expand Down Expand Up @@ -189,7 +189,7 @@ private Object getValue(List<Object> path, String key) throws IOException {
}
}
String builtPath = Matcher.quoteReplacement(pathBuilder.toString());
StringBuffer newKey = new StringBuffer(key.length());
StringBuilder newKey = new StringBuilder(key.length());
do {
matcher.appendReplacement(newKey, builtPath);
} while (matcher.find());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ public class BCrypt {
*/
private static String encode_base64(byte d[], int len) throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
StringBuilder rs = new StringBuilder();
int c1, c2;

if (len <= 0 || len > d.length) throw new IllegalArgumentException("Invalid len");
Expand Down Expand Up @@ -1387,7 +1387,7 @@ private static byte char64(char x) {
* @throws IllegalArgumentException if maxolen is invalid
*/
private static byte[] decode_base64(String s, int maxolen) throws IllegalArgumentException {
StringBuffer rs = new StringBuffer();
StringBuilder rs = new StringBuilder();
int off = 0, slen = s.length(), olen = 0;
byte ret[];
byte c1, c2, c3, c4, o;
Expand Down Expand Up @@ -1599,7 +1599,7 @@ public static String hashpw(SecureString password, String salt) {
byte passwordb[], saltb[], hashed[];
char minor = (char) 0;
int rounds, off = 0;
StringBuffer rs = new StringBuffer();
StringBuilder rs = new StringBuilder();

if (salt.charAt(0) != '$' || salt.charAt(1) != '2') throw new IllegalArgumentException("Invalid salt version");
if (salt.charAt(2) == '$') off = 3;
Expand Down Expand Up @@ -1674,7 +1674,7 @@ static boolean valid_minor(char minor) {
* @return an encoded salt value
*/
public static String gensalt(int log_rounds, SecureRandom random) {
StringBuffer rs = new StringBuffer();
StringBuilder rs = new StringBuilder();
byte rnd[] = new byte[BCRYPT_SALT_LEN];

random.nextBytes(rnd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void addField(String key, Object value) {
}

String fields() {
StringBuffer s = new StringBuffer();
StringBuilder s = new StringBuilder();
for (Map.Entry<?, ?> entry : fields.entrySet()) {
if (s.length() > 0) {
s.append(", ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void testCsvFormatWithCustomDelimiterRegularData() {
List<String> expectedTerms = terms.stream()
.map(x -> x.contains(String.valueOf(delim)) ? '"' + x + '"' : x)
.collect(Collectors.toList());
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
do {
sb.append(expectedTerms.remove(0));
sb.append(delim);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static String convertToString(byte[] bytes) {
}

char[] hex = Hex.encodeHex(bytes);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();

// start with 'S'
sb.append('S');
Expand All @@ -76,7 +76,7 @@ public static String convertToString(byte[] bytes) {

// sub-authorities, little-endian
for (int i = 0; i < count; i++) {
StringBuffer rid = new StringBuffer();
StringBuilder rid = new StringBuilder();

for (int k = 3; k >= 0; k--) {
rid.append(hex[16 + (i * 8) + (k * 2)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public static String repeatString(String in, int count) {
if (count < 0) {
throw new IllegalArgumentException("negative count: " + count);
}
StringBuffer sb = new StringBuffer(in.length() * count);
StringBuilder sb = new StringBuilder(in.length() * count);
for (int i = 0; i < count; i++) {
sb.append(in);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testInvalidVersion() {
private static final String JAR_PATH_SEPARATOR = "!/";

private static String versionString(byte[] parts) {
StringBuffer version = new StringBuffer();
StringBuilder version = new StringBuilder();
for (byte part : parts) {
version.append(".");
version.append(part);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testCsvFormatWithCustomDelimiterRegularData() {
List<String> expectedTerms = terms.stream()
.map(x -> x.contains(String.valueOf(delim)) ? '"' + x + '"' : x)
.collect(Collectors.toList());
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
do {
sb.append(expectedTerms.remove(0));
sb.append(delim);
Expand Down