Пример #1
0
 @Override
 public void remove(String name) throws PresetNotFoundException {
   for (Preset preset : list)
     if (preset.name().equalsIgnoreCase(name)) {
       list.remove(preset);
       return;
     }
   throw new PresetNotFoundException("Preset.id(" + name + ") not found");
 }
Пример #2
0
 @Override
 public List<String> list() {
   List<String> names = new ArrayList<String>();
   for (Preset preset : list) names.add(preset.name());
   return names;
 }
Пример #3
0
 @Override
 public void put(Preset preset) {
   int index = find(preset.name());
   if (index >= 0) list.remove(index);
   list.add(preset);
 }