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 2025/10/11 17:58:39 UTC
(commons-collections) 02/02: USe for-each
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 494d5e99d35eefccf60a8a6e03df883e84ed2e75
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Oct 11 13:58:32 2025 -0400
USe for-each
---
.../collections4/properties/SortedPropertiesTest.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/properties/SortedPropertiesTest.java b/src/test/java/org/apache/commons/collections4/properties/SortedPropertiesTest.java
index 7d25f9234..63c14ec49 100644
--- a/src/test/java/org/apache/commons/collections4/properties/SortedPropertiesTest.java
+++ b/src/test/java/org/apache/commons/collections4/properties/SortedPropertiesTest.java
@@ -38,22 +38,22 @@ class SortedPropertiesTest {
private SortedProperties assertAscendingOrder(final SortedProperties sortedProperties) {
final String[] keys = { "1", "10", "11", "2", "3", "4", "5", "6", "7", "8", "9" };
final Enumeration<Object> enumObjects = sortedProperties.keys();
- for (int i = 0; i < keys.length; i++) {
- assertEquals("key" + keys[i], enumObjects.nextElement());
+ for (final String key : keys) {
+ assertEquals("key" + key, enumObjects.nextElement());
}
final Iterator<Object> iterSet = sortedProperties.keySet().iterator();
- for (int i = 0; i < keys.length; i++) {
- assertEquals("key" + keys[i], iterSet.next());
+ for (final String key : keys) {
+ assertEquals("key" + key, iterSet.next());
}
final Iterator<Entry<Object, Object>> iterEntrySet = sortedProperties.entrySet().iterator();
- for (int i = 0; i < keys.length; i++) {
+ for (final String key : keys) {
final Entry<Object, Object> next = iterEntrySet.next();
- assertEquals("key" + keys[i], next.getKey());
- assertEquals("value" + keys[i], next.getValue());
+ assertEquals("key" + key, next.getKey());
+ assertEquals("value" + key, next.getValue());
}
final Enumeration<?> propertyNames = sortedProperties.propertyNames();
- for (int i = 0; i < keys.length; i++) {
- assertEquals("key" + keys[i], propertyNames.nextElement());
+ for (final String key : keys) {
+ assertEquals("key" + key, propertyNames.nextElement());
}
final Set<String> propertyNameSet = sortedProperties.stringPropertyNames();
final AtomicInteger i = new AtomicInteger(0);