diff --git a/commandsv3/src/main/java/org/wpilib/command3/Coroutine.java b/commandsv3/src/main/java/org/wpilib/command3/Coroutine.java index 11f262d8f38..d45a1780a92 100644 --- a/commandsv3/src/main/java/org/wpilib/command3/Coroutine.java +++ b/commandsv3/src/main/java/org/wpilib/command3/Coroutine.java @@ -202,10 +202,8 @@ public boolean partialSuccess() { *
This method does nothing if no commands were successfully forked. */ public void awaitCompletion() { - for (Command command : m_forkedCommands) { - if (m_scheduler.isRunning(command)) { - Coroutine.this.yield(); - } + while (m_forkedCommands.stream().anyMatch(m_scheduler::isRunning)) { + Coroutine.this.yield(); } }