File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 15
15
import java .util .Collection ;
16
16
import java .util .HashSet ;
17
17
import java .util .Set ;
18
+ import java .util .concurrent .atomic .AtomicInteger ;
18
19
import java .util .function .BooleanSupplier ;
19
20
20
21
/**
@@ -400,8 +401,10 @@ public RepeatCommand repeatedly() {
400
401
* @return the decorated command
401
402
*/
402
403
public ParallelRaceGroup repeatedly (int times ) {
403
- int [] counter = {0 };
404
- return this .finallyDo (() -> counter [0 ]++).repeatedly ().until (() -> counter [0 ] >= times );
404
+ AtomicInteger counter = new AtomicInteger (0 );
405
+ return this .finallyDo (counter ::getAndIncrement )
406
+ .repeatedly ()
407
+ .until (() -> counter .get () >= times );
405
408
}
406
409
407
410
/**
You can’t perform that action at this time.
0 commit comments