Skip to content

Commit 644705c

Browse files
made string arguments get created eagerly rather than once per method call
1 parent a97f0cf commit 644705c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/datasiqn/commandcore/argument/StringArguments.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
*/
1212
public class StringArguments implements Arguments {
1313
private final List<String> allArguments;
14+
private final String stringArguments;
1415

1516
/**
1617
* Creates a new {@code ListArguments}
1718
* @param args The arguments in a string list
1819
*/
1920
public StringArguments(List<String> args) {
2021
allArguments = args;
22+
stringArguments = String.join(" ", allArguments);
2123
}
2224

2325
@Override
@@ -39,7 +41,7 @@ public int size() {
3941

4042
@Override
4143
public @NotNull ArgumentReader asReader() {
42-
return new StringArgumentReader(String.join(" ", allArguments));
44+
return new StringArgumentReader(stringArguments);
4345
}
4446

4547
private void checkBounds(int i) {

0 commit comments

Comments
 (0)