From 0798e8b3319363919681b070a6e204825fceed16 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 16 Dec 2024 16:57:47 -0800 Subject: [PATCH] Use enhanced for loop --- src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java | 3 +-- src/main/java/hudson/plugins/ec2/Tenancy.java | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java b/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java index 21b4df61d..3e04b5410 100644 --- a/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java +++ b/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java @@ -265,8 +265,7 @@ private boolean itemsInQueueForThisSlave(EC2Computer c) { } final Label selfLabel = selfNode.getSelfLabel(); Queue.Item[] items = Jenkins.getInstance().getQueue().getItems(); - for (int i = 0; i < items.length; i++) { - Queue.Item item = items[i]; + for (Queue.Item item : items) { final Label assignedLabel = item.getAssignedLabel(); if (assignedLabel == selfLabel) { LOGGER.fine("Preventing idle timeout of " + c.getName() diff --git a/src/main/java/hudson/plugins/ec2/Tenancy.java b/src/main/java/hudson/plugins/ec2/Tenancy.java index 93b995f5e..bed6372cb 100644 --- a/src/main/java/hudson/plugins/ec2/Tenancy.java +++ b/src/main/java/hudson/plugins/ec2/Tenancy.java @@ -18,11 +18,7 @@ public String toString() { public static Tenancy fromValue(String value) { if (value != null && !"".equals(value)) { - Tenancy[] var1 = values(); - int var2 = var1.length; - - for (int var3 = 0; var3 < var2; ++var3) { - Tenancy enumEntry = var1[var3]; + for (Tenancy enumEntry : values()) { if (enumEntry.toString().equals(value)) { return enumEntry; }