Remove unnecessary toString() calls

See gh-38739
This commit is contained in:
Yanming Zhou
2023-12-19 22:24:49 -08:00
committed by Phillip Webb
parent b6e87cee35
commit 8599e5a986
19 changed files with 30 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-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.
@@ -141,7 +141,7 @@ public class Snake {
sb.append(',');
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
}
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-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.
@@ -77,7 +77,7 @@ public final class SnakeTimer {
sb.append(',');
}
}
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
}
public static void broadcast(String message) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-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.
@@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
sb.append(',');
}
}
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-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.
@@ -141,7 +141,7 @@ public class Snake {
sb.append(',');
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
}
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-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.
@@ -77,7 +77,7 @@ public final class SnakeTimer {
sb.append(',');
}
}
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
}
public static void broadcast(String message) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-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.
@@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
sb.append(',');
}
}
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-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.
@@ -141,7 +141,7 @@ public class Snake {
sb.append(',');
sb.append(String.format("{x: %d, y: %d}", Integer.valueOf(location.x), Integer.valueOf(location.y)));
}
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb.toString());
return String.format("{'id':%d,'body':[%s]}", Integer.valueOf(this.id), sb);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-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.
@@ -77,7 +77,7 @@ public final class SnakeTimer {
sb.append(',');
}
}
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb));
}
public static void broadcast(String message) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-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.
@@ -74,7 +74,7 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler {
sb.append(',');
}
}
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb.toString()));
SnakeTimer.broadcast(String.format("{'type': 'join','data':[%s]}", sb));
}
@Override