Merge pull request #31802 from Drezir
* pr/31802: Polish "Use String.repeat instead of explicit cycle" Use String.repeat instead of explicit cycle Closes gh-31802
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -98,9 +98,7 @@ public final class ParseState {
|
||||
for (ParseState.Entry entry : this.state) {
|
||||
if (i > 0) {
|
||||
sb.append('\n');
|
||||
for (int j = 0; j < i; j++) {
|
||||
sb.append('\t');
|
||||
}
|
||||
sb.append("\t".repeat(i));
|
||||
sb.append("-> ");
|
||||
}
|
||||
sb.append(entry);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,9 +68,7 @@ public class PatternParseException extends IllegalArgumentException {
|
||||
public String toDetailedString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.pattern).append('\n');
|
||||
for (int i = 0; i < this.position; i++) {
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append(" ".repeat(Math.max(0, this.position)));
|
||||
sb.append("^\n");
|
||||
sb.append(getMessage());
|
||||
return sb.toString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,9 +81,7 @@ class ToStringVisitor implements RouterFunctions.Visitor, RequestPredicates.Visi
|
||||
}
|
||||
|
||||
private void indent() {
|
||||
for (int i = 0; i < this.indent; i++) {
|
||||
this.builder.append(' ');
|
||||
}
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -80,9 +80,7 @@ class ToStringVisitor implements RouterFunctions.Visitor, RequestPredicates.Visi
|
||||
}
|
||||
|
||||
private void indent() {
|
||||
for (int i = 0; i < this.indent; i++) {
|
||||
this.builder.append(' ');
|
||||
}
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,9 +59,7 @@ public abstract class AbstractSockJsMessageCodec implements SockJsMessageCodec {
|
||||
if (isSockJsSpecialChar(c)) {
|
||||
result.append('\\').append('u');
|
||||
String hex = Integer.toHexString(c).toLowerCase();
|
||||
for (int i = 0; i < (4 - hex.length()); i++) {
|
||||
result.append('0');
|
||||
}
|
||||
result.append("0".repeat(Math.max(0, (4 - hex.length()))));
|
||||
result.append(hex);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user