Changeset 12954 in josm for trunk


Ignore:
Timestamp:
2017-10-08T19:03:07+02:00 (7 years ago)
Author:
bastiK
Message:

see #15410 - better sorting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

    r12953 r12954  
    7676    private JButton remove;
    7777
    78     private static class ColorEntry implements Comparable<ColorEntry> {
     78    private static class ColorEntry {
    7979        String key;
    8080        Color color;
     
    9191        public String getDisplay() {
    9292            return Main.pref.getColorName(key);
    93         }
    94 
    95         @Override
    96         public int compareTo(ColorEntry o) {
    97             if (o == null) return -1;
    98             return Collator.getInstance().compare(getDisplay(), o.getDisplay());
    9993        }
    10094    }
     
    208202
    209203    private void addColorRows(List<ColorEntry> entries) {
    210         Collections.sort(entries);
     204        Collections.sort(entries, (e1, e2) -> Collator.getInstance().compare(e1.getDisplay(), e2.getDisplay()));
    211205        entries.forEach(tableModel::addEntry);
    212206    }
Note: See TracChangeset for help on using the changeset viewer.