diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Alert.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Alert.java index fc0e4cafad8..8f66dc1b905 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Alert.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Alert.java @@ -110,7 +110,10 @@ public Alert(String group, String text, AlertType type) { * @param active Whether to display the alert. */ public void set(boolean active) { - if (active == m_active) return; + if (active == m_active) { + return; + } + if (active) { m_activeStartTime = RobotController.getFPGATime(); m_group.getSetForType(m_type).add(new PublishedAlert(m_activeStartTime, m_text)); @@ -140,8 +143,7 @@ public void setText(String text) { } } - private static final record PublishedAlert(long timestamp, String text) - implements Comparable { + private record PublishedAlert(long timestamp, String text) implements Comparable { private static final Comparator comparator = Comparator.comparingLong((PublishedAlert alert) -> alert.timestamp()) .thenComparing(Comparator.comparing((PublishedAlert alert) -> alert.text())); @@ -165,7 +167,7 @@ private String[] getStrings(AlertType type) { // TODO: some optimizations available here- could iterate explicitly and cache the array for // potential reuse (if size is same, refill array, if nothing has changed, return original // array) - return getSetForType(type).stream().map((a) -> a.text()).toArray(String[]::new); + return getSetForType(type).stream().map(a -> a.text()).toArray(String[]::new); } @Override