Changeset 3456 in josm for trunk/src/org


Ignore:
Timestamp:
2010-08-21T23:11:30+02:00 (14 years ago)
Author:
bastiK
Message:

use Java's native String intern feature

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r3423 r3456  
    121121        private long currentExternalId;
    122122        private String generator;
    123         private Storage<String> internedStrings = new Storage<String>();
    124 
    125         // Memory optimization - see #2312
    126         private String intern(String s) {
    127             String result = internedStrings.get(s);
    128             if (result == null) {
    129                 internedStrings.put(s);
    130                 return s;
    131             } else
    132                 return result;
    133         }
    134123
    135124        @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
     
    276265                        throwException(tr("Missing key or value attribute in tag."));
    277266                    }
    278                     currentPrimitive.put(intern(key), intern(value));
     267                    currentPrimitive.put(key.intern(), value.intern());
    279268
    280269                } else {
Note: See TracChangeset for help on using the changeset viewer.