Ignore:
Timestamp:
2020-02-23T13:40:09+01:00 (4 years ago)
Author:
simon04
Message:

see #18749 - Use efficient/unmodifiable maps for svgSalamander

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/SVGElement.java

    r15904 r15912  
    4747import java.util.LinkedList;
    4848import java.util.List;
     49import java.util.Map;
    4950import java.util.Set;
    5051import java.util.regex.Matcher;
     
    8990     * Styles defined for this elemnt via the <b>style</b> attribute.
    9091     */
    91     protected final HashMap<String, String> inlineStyles = new HashMap<>();
     92    private Map<String, String> inlineStyles = Collections.emptyMap();
    9293    /**
    9394     * Presentation attributes set for this element. Ie, any attribute other
    9495     * than the <b>style</b> attribute.
    9596     */
    96     protected final HashMap<String, String> presAttributes = new HashMap<>();
     97    private Map<String, String> presAttributes = Collections.emptyMap();
    9798    /**
    9899     * A list of presentation attributes to not include in the presentation
     
    273274        if (style != null)
    274275        {
    275             XMLParseUtil.parseStyle(style, inlineStyles);
     276            inlineStyles = XMLParseUtil.parseStyle(style);
    276277        }
    277278
     
    299300            String value = attrs.getValue(i);
    300301
     302            if (i == 0)
     303            {
     304                presAttributes = new HashMap<>();
     305            }
    301306            presAttributes.put(name, value == null ? null : value.intern());
    302307        }
     308        presAttributes = XMLParseUtil.toUnmodifiableMap(presAttributes);
    303309    }
    304310
Note: See TracChangeset for help on using the changeset viewer.