We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b2c924 commit e122b0cCopy full SHA for e122b0c
wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java
@@ -15,6 +15,7 @@
15
import java.util.Collection;
16
import java.util.HashSet;
17
import java.util.Set;
18
+import java.util.concurrent.atomic.AtomicInteger;
19
import java.util.function.BooleanSupplier;
20
21
/**
@@ -400,8 +401,10 @@ public RepeatCommand repeatedly() {
400
401
* @return the decorated command
402
*/
403
public ParallelRaceGroup repeatedly(int times) {
- int[] counter = {0};
404
- return this.finallyDo(() -> counter[0]++).repeatedly().until(() -> counter[0] >= times);
+ AtomicInteger counter = new AtomicInteger(0);
405
+ return this.finallyDo(counter::getAndIncrement)
406
+ .repeatedly()
407
+ .until(() -> counter.get() >= times);
408
}
409
410
0 commit comments