コード例 #1
0
 private MyTableModel() {
   myAll = Registry.getAll();
   Collections.sort(
       myAll,
       new Comparator<RegistryValue>() {
         public int compare(RegistryValue o1, RegistryValue o2) {
           return o1.getKey().compareTo(o2.getKey());
         }
       });
 }
コード例 #2
0
    private MyTableModel() {
      myAll = Registry.getAll();
      final List<String> recent = getRecent();

      Collections.sort(
          myAll,
          new Comparator<RegistryValue>() {
            @Override
            public int compare(@NotNull RegistryValue o1, @NotNull RegistryValue o2) {
              final String key1 = o1.getKey();
              final String key2 = o2.getKey();
              final int i1 = recent.indexOf(key1);
              final int i2 = recent.indexOf(key2);
              final boolean c1 = i1 != -1;
              final boolean c2 = i2 != -1;
              if (c1 && !c2) return -1;
              if (!c1 && c2) return 1;
              if (c1 && c2) return i1 - i2;
              return key1.compareToIgnoreCase(key2);
            }
          });
    }