void (List<Configurable> list) { for (int i = 0; i < list.size(); i++) { Configurable configurable = list.get(i); if (configurable instanceof SortedConfigurableGroup group) { configurable = getConfigurableToReplace(group.myList, group.getWeight()); if (configurable != null) { list.set(i, configurable); } } } }