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 2022/05/01 12:46:08 UTC

[commons-bcel] 39/49: Use a for-each loop.

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-bcel.git

commit 60eb89a14451a15c7d2b97928f69d2df644dc93f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 1 08:36:28 2022 -0400

    Use a for-each loop.
---
 src/examples/Mini/ParseException.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/examples/Mini/ParseException.java b/src/examples/Mini/ParseException.java
index a95b50de..67619b70 100644
--- a/src/examples/Mini/ParseException.java
+++ b/src/examples/Mini/ParseException.java
@@ -121,8 +121,8 @@ public class ParseException extends Exception {
       if (maxSize < expectedTokenSequence.length) {
         maxSize = expectedTokenSequence.length;
       }
-      for (int j = 0; j < expectedTokenSequence.length; j++) {
-        expected += tokenImage[expectedTokenSequence[j]] + " ";
+      for (final int element : expectedTokenSequence) {
+        expected += tokenImage[element] + " ";
       }
       if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) {
         expected += "...";
@@ -163,7 +163,7 @@ public class ParseException extends Exception {
    * string literal.
    */
   protected String add_escapes(final String str) {
-      final StringBuffer retval = new StringBuffer();
+      final StringBuilder retval = new StringBuilder();
       char ch;
       for (int i = 0; i < str.length(); i++) {
         switch (str.charAt(i))