Ignore:
Timestamp:
2015-10-10T01:40:42+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib - minor performance improvements:

  • Method passes constant String of length 1 to character overridden method
  • Method needlessly boxes a boolean constant
  • Method uses iterator().next() on a List to get the first item
  • Method converts String to boxed primitive using excessive boxing
  • Method converts String to primitive using excessive boxing
  • Method creates array using constants
  • Class defines List based fields but uses them like Sets
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/template_engine/Tokenizer.java

    r8510 r8846  
    33
    44import java.util.Arrays;
    5 import java.util.List;
     5import java.util.HashSet;
     6import java.util.Set;
    67
    78public class Tokenizer {
     
    3637        @Override
    3738        public String toString() {
    38             return type + (text != null ? " " + text : "");
     39            return type + (text != null ? ' ' + text : "");
    3940        }
    4041    }
     
    4243    public enum TokenType { CONDITION_START, VARIABLE_START, CONTEXT_SWITCH_START, END, PIPE, APOSTROPHE, TEXT, EOF }
    4344
    44     private final List<Character> specialCharaters = Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'});
     45    private final Set<Character> specialCharaters = new HashSet<>(Arrays.asList(new Character[] {'$', '?', '{', '}', '|', '\'', '!'}));
    4546
    4647    private final String template;
Note: See TracChangeset for help on using the changeset viewer.