Changeset 15754 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-01-23T22:57:42+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
r15215 r15754 8 8 import java.util.List; 9 9 import java.util.Map; 10 import java.util.Objects; 10 11 import java.util.Optional; 11 12 import java.util.Set; … … 70 71 */ 71 72 public List<SourceEntry> get() { 72 73 73 List<Map<String, String>> src = Config.getPref().getListOfMaps(pref, null); 74 74 if (src == null) 75 75 return new ArrayList<>(getDefault()); 76 77 List<SourceEntry> entries = new ArrayList<>(); 78 for (Map<String, String> sourcePref : src) { 79 SourceEntry e = deserialize(new HashMap<>(sourcePref)); 80 if (e != null) { 81 entries.add(e); 82 } 83 } 84 return entries; 76 return src.stream() 77 .map(sourcePref -> deserialize(new HashMap<>(sourcePref))) 78 .filter(Objects::nonNull) 79 .collect(Collectors.toList()); 85 80 } 86 81 … … 110 105 */ 111 106 public final Set<String> getActiveUrls() { 112 Set<String> urls = new LinkedHashSet<>(); // retain order 113 for (SourceEntry e : get()) { 114 if (e.active) { 115 urls.add(e.url); 116 } 117 } 118 return urls; 107 return get().stream() 108 .filter(e -> e.active) 109 .map(e -> e.url) 110 .collect(Collectors.toCollection(LinkedHashSet::new)); // LinkedHashSet to retain order 119 111 } 120 112 }
Note:
See TracChangeset
for help on using the changeset viewer.