Ignore:
Timestamp:
2020-02-23T00:29:53+01:00 (4 years ago)
Author:
simon04
Message:

see #18749 - Use efficient/unmodifiable collections

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java

    r15717 r15909  
    88import org.openstreetmap.josm.gui.mappaint.Environment;
    99import org.openstreetmap.josm.gui.mappaint.StyleSource;
     10import org.openstreetmap.josm.tools.Utils;
    1011
    1112/**
     
    4849         */
    4950        public Declaration(List<Instruction> instructions, int idx) {
    50             this.instructions = instructions;
     51            this.instructions = Utils.toUnmodifiableList(instructions);
    5152            this.idx = idx;
    5253        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r15730 r15909  
    537537
    538538        protected AbstractSelector(List<Condition> conditions) {
    539             if (conditions == null || conditions.isEmpty()) {
    540                 this.conds = null;
    541             } else {
    542                 this.conds = conditions;
    543             }
     539            this.conds = Utils.toUnmodifiableList(conditions);
    544540        }
    545541
     
    552548        public boolean matches(Environment env) {
    553549            CheckParameterUtil.ensureParameterNotNull(env, "env");
    554             if (conds == null) return true;
    555550            for (Condition c : conds) {
    556551                try {
     
    569564         */
    570565        public List<Condition> getConditions() {
    571             if (conds == null) {
    572                 return Collections.emptyList();
    573             }
    574             return Collections.unmodifiableList(conds);
     566            return conds;
    575567        }
    576568    }
Note: See TracChangeset for help on using the changeset viewer.