You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/07/07 17:38:49 UTC
commons-collections git commit: Use a Java 5 for each loop.
Repository: commons-collections
Updated Branches:
refs/heads/master d86509b09 -> 525d1fd7c
Use a Java 5 for each loop.
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/525d1fd7
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/525d1fd7
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/525d1fd7
Branch: refs/heads/master
Commit: 525d1fd7ca383b3426341c58ba9e2d2e886a59ac
Parents: d86509b
Author: Gary Gregory <ga...@gmail.com>
Authored: Sat Jul 7 11:38:47 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Sat Jul 7 11:38:47 2018 -0600
----------------------------------------------------------------------
.../collections4/map/AbstractMapTest.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/525d1fd7/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
index 50c09af..cd9a462 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
@@ -647,9 +647,9 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
final Object[] values = getSampleValues();
resetEmpty();
- for(int i = 0; i < values.length; i++) {
+ for (Object value : values) {
assertTrue("Empty map must not contain value",
- !getMap().containsValue(values[i]));
+ !getMap().containsValue(value));
}
verify();
@@ -1203,12 +1203,12 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
resetFull();
final V[] sampleValues = getSampleValues();
final Collection<V> values = getMap().values();
- for (int i = 0; i < sampleValues.length; i++) {
- if (map.containsValue(sampleValues[i])) {
+ for (V sampleValue : sampleValues) {
+ if (map.containsValue(sampleValue)) {
int j = 0; // loop counter prevents infinite loops when remove is broken
- while (values.contains(sampleValues[i]) && j < 10000) {
+ while (values.contains(sampleValue) && j < 10000) {
try {
- values.remove(sampleValues[i]);
+ values.remove(sampleValue);
} catch (final UnsupportedOperationException e) {
// if values.remove is unsupported, just skip this test
return;
@@ -1218,7 +1218,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
assertTrue("values().remove(obj) is broken", j < 10000);
assertTrue(
"Value should have been removed from the underlying map.",
- !getMap().containsValue(sampleValues[i]));
+ !getMap().containsValue(sampleValue));
}
}
}
@@ -1315,16 +1315,16 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
resetFull();
final K[] sampleKeys = getSampleKeys();
final Set<K> keys = getMap().keySet();
- for (int i = 0; i < sampleKeys.length; i++) {
+ for (K sampleKey : sampleKeys) {
try {
- keys.remove(sampleKeys[i]);
+ keys.remove(sampleKey);
} catch (final UnsupportedOperationException e) {
// if key.remove is unsupported, just skip this test
return;
}
assertTrue(
"Key should have been removed from the underlying map.",
- !getMap().containsKey(sampleKeys[i]));
+ !getMap().containsKey(sampleKey));
}
}