Skip to content

Commit

Permalink
Replaces simple uses of Iterator with a corresponding jdk5 for-loop.
Browse files Browse the repository at this point in the history
Change-Id: Iaee769270e560e3c015b91293a9bc7aa586e16a2
Signed-off-by: Carsten Hammer <[email protected]>
  • Loading branch information
carstenartur authored and joehni committed Jul 3, 2019
1 parent 5427e6e commit 47277a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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));
}
}

}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -87,11 +87,11 @@ private static boolean equals(final JSONObject object1, final JSONObject object2
}
if (new HashSet<String>(Arrays.asList(names)).equals(new HashSet<String>(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) {
Expand Down

0 comments on commit 47277a9

Please sign in to comment.