From 72194b7982ddfa8e9864d0a9934905bb76b90f33 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 8 Aug 2020 03:06:37 +0200 Subject: 'for' loop replaceable with enhanced 'for' loop Reports for loops which iterate over collections or arrays, and can be replaced with an enhanced for loop (i.e. the foreach iteration syntax). Signed-off-by: Lars Grefer --- .../src/main/java/org/aspectj/testing/Tester.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'testing-client/src/main') diff --git a/testing-client/src/main/java/org/aspectj/testing/Tester.java b/testing-client/src/main/java/org/aspectj/testing/Tester.java index ed0c60f3a..d42bcd994 100644 --- a/testing-client/src/main/java/org/aspectj/testing/Tester.java +++ b/testing-client/src/main/java/org/aspectj/testing/Tester.java @@ -831,10 +831,10 @@ public class Tester { /** add expected events */ public static void expectEvents(Object[] events) { if (null != events) { - for (int i = 0; i < events.length; i++) { - if (null != events[i]) { - expectEvent(events[i].toString()); - } + for (Object event : events) { + if (null != event) { + expectEvent(event.toString()); + } } } } @@ -842,11 +842,11 @@ public class Tester { /** add expected events */ public static void expectEvents(String[] events) { if (null != events) { - for (int i = 0; i < events.length; i++) { - if (null != events[i]) { - expectEvent(events[i].toString()); - } - } + for (String event : events) { + if (null != event) { + expectEvent(event.toString()); + } + } } } @@ -946,9 +946,9 @@ public class Tester { /** XXX deprecated */ public static void printEvents() { // XXX no clients? - for (Iterator i = actualEvents.iterator(); i.hasNext(); ) { - System.out.println(i.next()); // XXX System.out - } + for (String actualEvent : actualEvents) { + System.out.println(actualEvent); // XXX System.out + } } /** -- cgit v1.2.3