From 47277a9a5fc25cc09371c812f4aa5e7c8a3e3709 Mon Sep 17 00:00:00 2001 From: Carsten Hammer Date: Sat, 27 Apr 2019 17:39:24 +0200 Subject: [PATCH] Replaces simple uses of Iterator with a corresponding jdk5 for-loop. Change-Id: Iaee769270e560e3c015b91293a9bc7aa586e16a2 Signed-off-by: Carsten Hammer --- .../converters/extended/DurationConverterTest.java | 13 ++++++------- .../xstream/io/json/JsonWriterModeTest.java | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/xstream/src/test/com/thoughtworks/xstream/converters/extended/DurationConverterTest.java b/xstream/src/test/com/thoughtworks/xstream/converters/extended/DurationConverterTest.java index 583a30587..d15cbeb92 100644 --- a/xstream/src/test/com/thoughtworks/xstream/converters/extended/DurationConverterTest.java +++ b/xstream/src/test/com/thoughtworks/xstream/converters/extended/DurationConverterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 XStream Committers. + * Copyright (C) 2007, 2019 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -27,12 +27,11 @@ public class DurationConverterTest extends TestCase { public void testConversion() throws Exception { final SingleValueConverter converter = new DurationConverter(); DatatypeFactory factory = DatatypeFactory.newInstance(); - for (int i = 0; i < STRINGS.length; i++) { - final String s = STRINGS[i]; - Duration o = factory.newDuration(s); - assertEquals(s, converter.toString(o)); - assertEquals(o, converter.fromString(s)); - } + for (String s : STRINGS) { + Duration o = factory.newDuration(s); + assertEquals(s, converter.toString(o)); + assertEquals(o, converter.fromString(s)); + } } } diff --git a/xstream/src/test/com/thoughtworks/xstream/io/json/JsonWriterModeTest.java b/xstream/src/test/com/thoughtworks/xstream/io/json/JsonWriterModeTest.java index 6f2e94618..3c444486e 100644 --- a/xstream/src/test/com/thoughtworks/xstream/io/json/JsonWriterModeTest.java +++ b/xstream/src/test/com/thoughtworks/xstream/io/json/JsonWriterModeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2013, 2018 XStream Committers. + * Copyright (C) 2009, 2011, 2013, 2018, 2019 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -87,11 +87,11 @@ private static boolean equals(final JSONObject object1, final JSONObject object2 } if (new HashSet(Arrays.asList(names)).equals(new HashSet(Arrays.asList(JSONObject.getNames( object2))))) { - for (int i = 0; i < names.length; i++) { - if (!equals(object1.get(names[i]), object2.get(names[i]))) { - return false; - } - } + for (String name : names) { + if (!equals(object1.get(name), object2.get(name))) { + return false; + } + } return true; } } catch (final JSONException e) {