Changeset 12095 in josm


Ignore:
Timestamp:
2017-05-10T22:24:16+02:00 (8 months ago)
Author:
michael2402
Message:

Extract color key searching (migration code) to new method.

This is cleaner and fixes a compile error in eclipse mars.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r11913 r12095  
    15351535        settingsMap.keySet().stream()
    15361536                .filter(key -> key.startsWith(COLOR_PREFIX))
    1537                 .flatMap(key -> {
    1538                     final String newKey = ColorProperty.getColorKey(key.substring(COLOR_PREFIX.length()));
    1539                     return key.equals(newKey) || settingsMap.containsKey(newKey)
    1540                             ? Stream.empty()
    1541                             : Stream.of(new AbstractMap.SimpleImmutableEntry<>(key, newKey));
    1542                 })
     1537                .flatMap(this::searchOldColorKey)
    15431538                .collect(Collectors.toList()) // to avoid ConcurrentModificationException
    15441539                .forEach(entry -> {
     
    15491544                    put(oldKey, null);
    15501545                });
     1546    }
     1547
     1548    private Stream<AbstractMap.SimpleImmutableEntry<String, String>> searchOldColorKey(String key) {
     1549        final String newKey = ColorProperty.getColorKey(key.substring(COLOR_PREFIX.length()));
     1550        return key.equals(newKey) || settingsMap.containsKey(newKey)
     1551                ? Stream.empty()
     1552                : Stream.of(new AbstractMap.SimpleImmutableEntry<>(key, newKey));
    15511553    }
    15521554
Note: See TracChangeset for help on using the changeset viewer.