Changeset 4374 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2011-08-28T13:58:57+02:00 (13 years ago)
Author:
bastiK
Message:

no duplicate entries in file history

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r4371 r4374  
    245245        Collection<String> oldHistory = Main.pref.getCollection("file-open.history");
    246246        List<String> history = new LinkedList<String>(oldHistory);
     247        history.remove(filepath);
    247248        history.add(0, filepath);
    248249        Main.pref.putCollectionBounded("file-open.history", maxsize, history);
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r4371 r4374  
    745745     */
    746746    public boolean putCollectionBounded(String key, int maxsize, Collection<String> val) {
    747         Collection<String> newCollection = new ArrayList<String>(maxsize);
     747        Collection<String> newCollection = new ArrayList<String>(Math.min(maxsize, val.size()));
    748748        for (String i : val) {
    749749            if (newCollection.size() >= maxsize) {
Note: See TracChangeset for help on using the changeset viewer.