void () { final List<InjInfo> selectedInjections = getSelectedInjections(); boolean enabledExists = false; boolean disabledExists = false; for (InjInfo info : selectedInjections) { if (info.injection.isEnabled()) enabledExists = true; else disabledExists = true; if (enabledExists && disabledExists) break; } boolean allEnabled = !enabledExists && disabledExists; performSelectedInjectionsEnabled(allEnabled); }