From e5e89aa9e3799a2596f9f8e61c7f1edc5f95ab44 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Fri, 16 Sep 2016 11:40:57 +0000 Subject: FOP-2648: Code cleanup, use foreach git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761021 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/util/text/AdvancedMessageFormat.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'fop-util/src') diff --git a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java index f8508e082..acb851553 100644 --- a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java +++ b/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java @@ -355,9 +355,7 @@ public class AdvancedMessageFormat { target.append(obj); } else { boolean handled = false; - Iterator iter = OBJECT_FORMATTERS.iterator(); - while (iter.hasNext()) { - ObjectFormatter formatter = iter.next(); + for (ObjectFormatter formatter : OBJECT_FORMATTERS) { if (formatter.supportsObject(obj)) { formatter.format(target, obj); handled = true; @@ -437,9 +435,7 @@ public class AdvancedMessageFormat { public void write(StringBuffer sb, Map params) { if (hasSections) { - Iterator iter = this.parts.iterator(); - while (iter.hasNext()) { - Part part = iter.next(); + for (Part part : this.parts) { if (part.isGenerated(params)) { part.write(sb, params); break; @@ -447,9 +443,7 @@ public class AdvancedMessageFormat { } } else { if (isGenerated(params)) { - Iterator iter = this.parts.iterator(); - while (iter.hasNext()) { - Part part = iter.next(); + for (Part part : this.parts) { part.write(sb, params); } } @@ -458,9 +452,7 @@ public class AdvancedMessageFormat { public boolean isGenerated(Map params) { if (hasSections) { - Iterator iter = this.parts.iterator(); - while (iter.hasNext()) { - Part part = iter.next(); + for (Part part : this.parts) { if (part.isGenerated(params)) { return true; } @@ -468,9 +460,7 @@ public class AdvancedMessageFormat { return false; } else { if (conditional) { - Iterator iter = this.parts.iterator(); - while (iter.hasNext()) { - Part part = iter.next(); + for (Part part : this.parts) { if (!part.isGenerated(params)) { return false; } -- cgit v1.2.3