Ignore:
Timestamp:
2020-11-29T10:33:58+01:00 (3 years ago)
Author:
GerdP
Message:

see #20167: [patch] Improve code readability by replacing indexed loops with foreach
Patch by gaben, slightly modified
I removed the changes for

  • GpxImageCorrelation.java, they introduce a TODO
  • ConnectivityRelations.java (no improvement in readability)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r15079 r17374  
    220220            StringBuilder expression = new StringBuilder();
    221221            int maxLength = 0;
    222             for (int i = 0; i < words.length; i++) {
    223                 if (words[i].length() > maxLength) {
    224                     maxLength = words[i].length();
     222            for (String word : words) {
     223                if (word.length() > maxLength) {
     224                    maxLength = word.length();
    225225                }
    226226                if (expression.length() > 0) {
    227227                    expression.append('|');
    228228                }
    229                 expression.append(Pattern.quote(words[i]));
     229                expression.append(Pattern.quote(word));
    230230            }
    231231            this.regExpr = Pattern.compile(expression.toString(), CASE_INSENSITIVE + UNICODE_CASE);
     
    243243            // which word matches?
    244244            String part = "";
    245             for (int i = 0; i < words.length; i++) {
    246                 String word = words[i];
     245            for (String word : words) {
    247246                if (start + word.length() <= name.length()) {
    248247                    part = name.substring(start, start + word.length());
Note: See TracChangeset for help on using the changeset viewer.