|
11 | 11 |
|
12 | 12 | import java.util.ArrayList; |
13 | 13 | import java.util.Arrays; |
14 | | -import java.util.Iterator; |
15 | 14 | import java.util.List; |
16 | 15 |
|
17 | 16 | public class OutputHandler implements VirtualOutputListener, PixelStreamReceiver { |
@@ -80,20 +79,18 @@ public void updateOpenRgbDevices() { |
80 | 79 | // clear cached list |
81 | 80 | cachedDeviceControllers.clear(); |
82 | 81 | // loop through all device ids |
83 | | - for(Iterator<Integer> it = devices.iterator(); it.hasNext();) { |
84 | | - int deviceId = it.next(); |
| 82 | + for (int deviceId : devices) { |
85 | 83 | // check if device is valid |
86 | | - if(deviceId < controllerCount) { |
| 84 | + if (deviceId < controllerCount) { |
87 | 85 | // add to cache list |
88 | 86 | cachedDeviceControllers.add(plugin.getOpenRGB().getControllerData(deviceId)); |
89 | 87 | } else { |
90 | 88 | // print error message and remove device id from list |
91 | 89 | OpenRgbPlugin.print(String.format("(%s) Found invalid device ID: %d There are only %d OpenRGB devices (max device ID: %d). Removing device from list.", |
92 | | - getName(), deviceId, controllerCount, controllerCount-1)); |
| 90 | + getName(), deviceId, controllerCount, controllerCount - 1)); |
93 | 91 | OpenRgbPlugin.getInstance().getInterface().getNotificationManager().addNotification( |
94 | | - new Notification(NotificationType.WARN,"OpenRGB Plugin (" + getName() + ")", |
95 | | - String.format("Invalid device ID: %d. Max device ID is %d. Removing device from list.", deviceId, controllerCount-1))); |
96 | | - it.remove(); |
| 92 | + new Notification(NotificationType.WARN, "OpenRGB Plugin (" + getName() + ")", |
| 93 | + String.format("Invalid device ID: %d. Max device ID is %d. Ignoring device.", deviceId, controllerCount - 1))); |
97 | 94 | } |
98 | 95 | } |
99 | 96 | } |
|
0 commit comments