Changeset 16436 in josm for trunk/src/org/openstreetmap/josm/spi/preferences/AbstractPreferences.java
- Timestamp:
- 2020-05-17T12:08:17+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/spi/preferences/AbstractPreferences.java
r14147 r16436 7 7 import java.util.Map.Entry; 8 8 import java.util.TreeMap; 9 import java.util.stream.Collectors; 9 10 10 11 import org.openstreetmap.josm.tools.Logging; … … 158 159 */ 159 160 public Map<String, String> getAllPrefix(String prefix) { 160 final Map<String, String> all = new TreeMap<>(); 161 for (final Entry<String, Setting<?>> e : getAllSettings().entrySet()) { 162 if (e.getKey().startsWith(prefix) && (e.getValue() instanceof StringSetting)) { 163 all.put(e.getKey(), ((StringSetting) e.getValue()).getValue()); 164 } 165 } 166 return all; 161 return getAllSettings().entrySet().stream() 162 .filter(e -> e.getKey().startsWith(prefix) && (e.getValue() instanceof StringSetting)) 163 .collect(Collectors.toMap(Entry::getKey, e -> ((StringSetting) e.getValue()).getValue(), (a, b) -> b, TreeMap::new)); 167 164 } 168 165 … … 173 170 */ 174 171 public List<String> getAllPrefixCollectionKeys(String prefix) { 175 final List<String> all = new LinkedList<>(); 176 for (Entry<String, Setting<?>> entry : getAllSettings().entrySet()) { 177 if (entry.getKey().startsWith(prefix) && entry.getValue() instanceof ListSetting) { 178 all.add(entry.getKey()); 179 } 180 } 181 return all; 172 return getAllSettings().entrySet().stream() 173 .filter(entry -> entry.getKey().startsWith(prefix) && entry.getValue() instanceof ListSetting) 174 .map(Entry::getKey) 175 .collect(Collectors.toCollection(LinkedList::new)); 182 176 } 183 177 }
Note:
See TracChangeset
for help on using the changeset viewer.
