Changeset 16438 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java
- Timestamp:
- 2020-05-17T14:18:22+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java
r12231 r16438 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.Arrays; 6 7 import java.util.Collection; 7 8 import java.util.Collections; 9 import java.util.stream.IntStream; 8 10 9 11 import org.openstreetmap.josm.tools.Utils; … … 57 59 @Override 58 60 public Collection<String> getPreferencesFromCode(String code) { 59 for (String code2 : CODES) { 60 if (code.equals(code2)) 61 return Collections.singleton(code2); 62 } 63 return null; 61 return Arrays.stream(CODES).filter(code::equals).findFirst().map(Collections::singleton).orElse(null); 64 62 } 65 63 … … 71 69 @Override 72 70 protected int zoneToIndex(String zone) { 73 for (int i = 0; i < CODES.length; i++) { 74 if (zone.equals(CODES[i])) { 75 return i; 76 } 77 } 78 return defaultIndex; 71 return IntStream.range(0, CODES.length) 72 .filter(i -> zone.equals(CODES[i])) 73 .findFirst().orElse(defaultIndex); 79 74 } 80 75 }
Note:
See TracChangeset
for help on using the changeset viewer.
