Ignore:
Timestamp:
2016-07-24T00:19:35+02:00 (8 years ago)
Author:
Don-vip
Message:

see #11390 - Java 8: use List.sort(Comparator) instead of Collections.sort(list, Comparator)

Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

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

    r10608 r10619  
    44import java.util.ArrayList;
    55import java.util.Collection;
    6 import java.util.Collections;
    76import java.util.HashMap;
    87import java.util.HashSet;
     
    7271        }
    7372        OsmPrimitiveComparator c = new OsmPrimitiveComparator(false, true);
    74         Collections.sort(toDelete, c);
    75         Collections.sort(toAdd, c);
    76         Collections.sort(toUpdate, c);
     73        toDelete.sort(c);
     74        toAdd.sort(c);
     75        toUpdate.sort(c);
    7776    }
    7877
     
    332331            }
    333332            List<Relation> ret = new ArrayList<>(relations);
    334             Collections.sort(
    335                     ret,
    336                     (o1, o2) -> Integer.compare(uploadOrder.indexOf(o1), uploadOrder.indexOf(o2))
    337                     );
     333            ret.sort((o1, o2) -> Integer.compare(uploadOrder.indexOf(o1), uploadOrder.indexOf(o2)));
    338334            return ret;
    339335        }
  • trunk/src/org/openstreetmap/josm/data/osm/NoteData.java

    r10608 r10619  
    102102    public Collection<Note> getSortedNotes() {
    103103        final List<Note> list = new ArrayList<>(noteList);
    104         Collections.sort(list, comparator);
     104        list.sort(comparator);
    105105        return list;
    106106    }
  • trunk/src/org/openstreetmap/josm/data/osm/history/History.java

    r10608 r10619  
    44import java.text.MessageFormat;
    55import java.util.ArrayList;
    6 import java.util.Collections;
    76import java.util.Date;
    87import java.util.List;
     
    6968    public History sortAscending() {
    7069        List<HistoryOsmPrimitive> copy = new ArrayList<>(versions);
    71         Collections.sort(copy, (o1, o2) -> o1.compareTo(o2));
     70        copy.sort((o1, o2) -> o1.compareTo(o2));
    7271        return new History(id, type, copy);
    7372    }
     
    7978    public History sortDescending() {
    8079        List<HistoryOsmPrimitive> copy = new ArrayList<>(versions);
    81         Collections.sort(copy, (o1, o2) -> o2.compareTo(o1));
     80        copy.sort((o1, o2) -> o2.compareTo(o1));
    8281        return new History(id, type, copy);
    8382    }
Note: See TracChangeset for help on using the changeset viewer.