Changeset 10647 in josm
- Timestamp:
- 2016-07-26T02:17:04+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r10619 r10647 4 4 import java.util.ArrayList; 5 5 import java.util.Collection; 6 import java.util.Comparator; 6 7 import java.util.HashMap; 7 8 import java.util.HashSet; … … 331 332 } 332 333 List<Relation> ret = new ArrayList<>(relations); 333 ret.sort( (o1, o2) -> Integer.compare(uploadOrder.indexOf(o1), uploadOrder.indexOf(o2)));334 ret.sort(Comparator.comparingInt(uploadOrder::indexOf)); 334 335 return ret; 335 336 } -
trunk/src/org/openstreetmap/josm/data/osm/history/History.java
r10619 r10647 4 4 import java.text.MessageFormat; 5 5 import java.util.ArrayList; 6 import java.util.Comparator; 6 7 import java.util.Date; 7 8 import java.util.List; … … 68 69 public History sortAscending() { 69 70 List<HistoryOsmPrimitive> copy = new ArrayList<>(versions); 70 copy.sort( (o1, o2) -> o1.compareTo(o2));71 copy.sort(Comparator.naturalOrder()); 71 72 return new History(id, type, copy); 72 73 } … … 78 79 public History sortDescending() { 79 80 List<HistoryOsmPrimitive> copy = new ArrayList<>(versions); 80 copy.sort( (o1, o2) -> o2.compareTo(o1));81 copy.sort(Comparator.reverseOrder()); 81 82 return new History(id, type, copy); 82 83 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerModel.java
r10619 r10647 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.Comparator; 8 9 import java.util.HashSet; 9 10 import java.util.List; … … 150 151 151 152 protected void sort() { 152 data.sort((o1, o2) -> { 153 if (o1.getId() < o2.getId()) return 1; 154 if (o1.getId() == o2.getId()) return 0; 155 return -1; 156 } 157 ); 153 data.sort(Comparator.comparingInt(Changeset::getId).reversed()); 158 154 } 159 155 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListModel.java
r10619 r10647 4 4 import java.util.ArrayList; 5 5 import java.util.Collection; 6 import java.util.Comparator; 6 7 import java.util.HashSet; 7 8 import java.util.List; … … 139 140 140 141 protected void sort() { 141 data.sort((cs1, cs2) -> { 142 if (cs1.getId() > cs2.getId()) return -1; 143 if (cs1.getId() == cs2.getId()) return 0; 144 return 1; 145 } 146 ); 142 data.sort(Comparator.comparingInt(Changeset::getId).reversed()); 147 143 } 148 144 -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersModel.java
r10619 r10647 6 6 import java.io.File; 7 7 import java.util.ArrayList; 8 import java.util.Comparator; 8 9 import java.util.List; 9 10 … … 70 71 layerInfo.add(new SaveLayerInfo(layer)); 71 72 } 72 layerInfo.sort( (o1, o2) -> o1.compareTo(o2));73 layerInfo.sort(Comparator.naturalOrder()); 73 74 fireTableDataChanged(); 74 75 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r10632 r10647 30 30 import java.util.Collection; 31 31 import java.util.Collections; 32 import java.util.Comparator; 32 33 import java.util.Date; 33 34 import java.util.Dictionary; … … 1082 1083 } 1083 1084 1084 dateImgLst.sort( (o1, o2) -> o1.getExifTime().compareTo(o2.getExifTime()));1085 dateImgLst.sort(Comparator.comparing(ImageEntry::getExifTime)); 1085 1086 1086 1087 return dateImgLst; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r10619 r10647 11 11 import java.util.Arrays; 12 12 import java.util.Collection; 13 import java.util.Comparator; 13 14 14 15 import javax.swing.AbstractAction; … … 87 88 // long as they don't overlap, that's fine) 88 89 if (sel.length > 1) { 89 Arrays.sort(sel, (a, b) -> a.lastModified() <= b.lastModified() ? -1 : 1);90 Arrays.sort(sel, Comparator.comparingLong(File::lastModified)); 90 91 } 91 92 StringBuilder names = new StringBuilder(); … … 277 278 /* we must have got at least one waypoint now */ 278 279 279 ((ArrayList<WayPoint>) waypoints).sort( (a, b) -> a.time <= b.time ? -1 : 1);280 ((ArrayList<WayPoint>) waypoints).sort(Comparator.comparingDouble(o -> o.time)); 280 281 281 282 firstTime = -1.0; /* this time of the first waypoint, not first trackpoint */ -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r10619 r10647 19 19 import java.util.ArrayList; 20 20 import java.util.Collection; 21 import java.util.Comparator; 21 22 import java.util.List; 22 23 … … 233 234 if (from instanceof MarkerLayer) { 234 235 data.addAll(((MarkerLayer) from).data); 235 data.sort( (o1, o2) -> Double.compare(o1.time, o2.time));236 data.sort(Comparator.comparingDouble(o -> o.time)); 236 237 } 237 238 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java
r10619 r10647 7 7 import java.awt.event.ActionEvent; 8 8 import java.util.ArrayList; 9 import java.util.Comparator; 9 10 import java.util.List; 10 11 import java.util.Map; … … 104 105 sortedStats.add(new Pair<>(e.getKey(), e.getValue()[0])); 105 106 } 106 sortedStats.sort( (o1, o2) -> -1 * o1.b.compareTo(o2.b));107 sortedStats.sort(Comparator.comparing(o -> o.b, Comparator.reverseOrder())); 107 108 String[][] ret = new String[sortedStats.size()][3]; 108 109 int index = 0; -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r10619 r10647 5 5 import java.util.ArrayList; 6 6 import java.util.Collection; 7 import java.util.Comparator; 7 8 import java.util.HashMap; 8 9 import java.util.HashSet; … … 146 147 */ 147 148 protected void sort() { 148 availablePlugins.sort((o1, o2) -> { 149 String n1 = o1.getName() == null ? "" : o1.getName().toLowerCase(Locale.ENGLISH); 150 String n2 = o2.getName() == null ? "" : o2.getName().toLowerCase(Locale.ENGLISH); 151 return n1.compareTo(n2); 152 } 153 ); 149 availablePlugins.sort(Comparator.comparing( 150 o -> o.getName() == null ? "" : o.getName().toLowerCase(Locale.ENGLISH))); 154 151 } 155 152 -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r10619 r10647 8 8 import java.util.ArrayList; 9 9 import java.util.Collection; 10 import java.util.Comparator; 10 11 import java.util.EnumSet; 11 12 import java.util.HashMap; … … 561 562 */ 562 563 protected void sort() { 563 tags.sort( (self, other) -> self.getName().compareTo(other.getName()));564 tags.sort(Comparator.comparing(TagModel::getName)); 564 565 } 565 566 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r10627 r10647 24 24 import java.util.Collection; 25 25 import java.util.Collections; 26 import java.util.Comparator; 26 27 import java.util.HashMap; 27 28 import java.util.HashSet; … … 745 746 // lower the value of "stage" the earlier the plugin should be loaded. 746 747 // 747 toLoad.sort((o1, o2) -> { 748 if (o1.stage < o2.stage) return -1; 749 if (o1.stage == o2.stage) return 0; 750 return 1; 751 } 752 ); 748 toLoad.sort(Comparator.comparingInt(o -> o.stage)); 753 749 if (toLoad.isEmpty()) 754 750 return; -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r10627 r10647 16 16 import java.util.Arrays; 17 17 import java.util.Collection; 18 import java.util.Comparator; 18 19 import java.util.HashMap; 19 20 import java.util.Locale; … … 381 382 Locale[] l = new Locale[v.size()]; 382 383 l = v.toArray(l); 383 Arrays.sort(l, (o1, o2) -> o1.toString().compareTo(o2.toString()));384 Arrays.sort(l, Comparator.comparing(Locale::toString)); 384 385 return l; 385 386 }
Note:
See TracChangeset
for help on using the changeset viewer.