void () { mySystemTable.getTableView().setEnabled(isIncludeSystemVars()); List<EnvironmentVariable> userList = new ArrayList<>(myUserTable.getEnvironmentVariables()); List<EnvironmentVariable> systemList = new ArrayList<>(mySystemTable.getEnvironmentVariables()); boolean[] dirty = {false}; if (isIncludeSystemVars()) { //System properties are included so overridden properties should be shown as 'bold' or 'modified' in a system table for (Iterator<EnvironmentVariable> iterator = userList.iterator(); iterator.hasNext(); ) { EnvironmentVariable userVariable = iterator.next(); Optional<EnvironmentVariable> optional = systemList.stream().filter(systemVariable -> systemVariable.getName().equals(userVariable.getName())).findAny(); optional.ifPresent(variable -> { if (!Objects.equals(variable.getValue(), userVariable.getValue())) { variable.setValue(userVariable.getValue()); iterator.remove(); dirty[0] = true; } }); } } else { // Overridden system properties should be shown as user variables as soon as system ones aren't included // Thus system table should look unmodified and disabled for (EnvironmentVariable systemVariable : systemList) { if (myParent.isModifiedSysEnv(systemVariable)) { Optional<EnvironmentVariable> optional = userList.stream().filter(userVariable -> userVariable.getName().equals(systemVariable.getName())).findAny(); if (optional.isPresent()) { optional.get().setValue(systemVariable.getValue()); } else { EnvironmentVariable clone = systemVariable.clone(); clone.IS_PREDEFINED = false; userList.add(clone); systemVariable.setValue(myParent.myParentDefaults.get(systemVariable.getName())); } dirty[0] = true; } } } if (dirty[0]) { myUserTable.setValues(userList); mySystemTable.setValues(systemList); } }