From 57ceb5b4f73085024625e3ceda29c7b25e12802d Mon Sep 17 00:00:00 2001 From: Kaya <95276965+kytpbs@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:47:09 +0100 Subject: [PATCH] More explicitly set initial counter value Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com> --- .../src/main/java/edu/wpi/first/wpilibj2/command/Command.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java index 3148489d25c..a46681bfd3c 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java @@ -418,7 +418,7 @@ public ParallelRaceGroup repeatedly(int repetitions) { // use an array so that it stays in the heap instead of stack. // We use an array with a size of 1 instead of `AtomicInteger` because of the performance // overhead - int[] counter = new int[1]; + int[] counter = {0}; return this.finallyDo(() -> counter[0]++).repeatedly().until(() -> counter[0] >= repetitions); }