Use enhanced for loop
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1588859 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
index 2f72426..80fe907 100644
--- a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
@@ -416,9 +416,7 @@
long milliseconds, final boolean padWithZeros) {
final StringBuilder buffer = new StringBuilder();
boolean lastOutputSeconds = false;
- final int sz = tokens.length;
- for (int i = 0; i < sz; i++) {
- final Token token = tokens[i];
+ for (final Token token : tokens) {
final Object value = token.getValue();
final int count = token.getCount();
if (value instanceof StringBuilder) {
@@ -443,7 +441,7 @@
buffer.append(paddedValue(seconds, padWithZeros, count));
lastOutputSeconds = true;
} else if (value == S) {
- if (lastOutputSeconds) {
+ if (lastOutputSeconds) {
// ensure at least 3 digits are displayed even if padding is not selected
int width = padWithZeros ? Math.max(3, count) : 3;
buffer.append(paddedValue(milliseconds, true, width));
@@ -572,9 +570,8 @@
* @return boolean <code>true</code> if contained
*/
static boolean containsTokenWithValue(final Token[] tokens, final Object value) {
- final int sz = tokens.length;
- for (int i = 0; i < sz; i++) {
- if (tokens[i].getValue() == value) {
+ for (Token token : tokens) {
+ if (token.getValue() == value) {
return true;
}
}