void (int index1, int index2) { ArrayList<DependencyRule> newList = new ArrayList<>(getItems()); DependencyRule r1 = newList.get(index1); DependencyRule r2 = newList.get(index2); newList.set(index1, r2); newList.set(index2, r1); setItems(newList); }