Source:
<code>private NewTableConfiguration attachIteratorToNewTable(final CommandLine cl, final Shell shellState, NewTableConfiguration ntc) { EnumSet<IteratorUtil.IteratorScope> scopeEnumSet = null; IteratorSetting iteratorSetting = null; if (shellState.iteratorProfiles.size() == 0) throw new IllegalArgumentException("No shell iterator profiles have been created."); String[] options = cl.getOptionValues(createTableOptIteratorProps.getOpt()); for (String profileInfo : options) { String[] parts = profileInfo.split(":", 2); String profileName = parts[0]; try { iteratorSetting = shellState.iteratorProfiles.get(profileName).get(0); } catch (NullPointerException ex) { throw new IllegalArgumentException("invalid iterator argument. Either profile does not exist or unexpected spaces in argument list.", ex); } if (parts.length == 1) { scopeEnumSet = EnumSet.allOf(IteratorUtil.IteratorScope.class); } else { List<String> scopeArgs = Arrays.asList(parts[1].split(",")); if (scopeArgs.size() > 3) throw new IllegalArgumentException("Too many scope arguments supplied"); if (scopeArgs.contains("all")) { if (scopeArgs.size() > 1) throw new IllegalArgumentException("Cannot use 'all' in conjunction with other scopes"); scopeEnumSet = EnumSet.allOf(IteratorUtil.IteratorScope.class); } else { <START> validateScopes(scopeArgs); <END> scopeEnumSet = addScopeArgsToIteratorEnumSet(scopeArgs); } } ntc.attachIterator(iteratorSetting, scopeEnumSet); } return ntc; }</code><technical_language>I if EnumSets mutable, I experiment are. this code simplified valueOf returns insert enum set. java public static void main(String[] args) { EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class); List<String> scopeStrs = new ArrayList<>(); scopeStrs.add("scan"); scopeStrs.add("minc"); scopeStrs.add("scan"); for (String scopeStr : scopeStrs) { IteratorScope scope = IteratorScope.valueOf(scopeStr); if (!scopes.add(scope)) { System.out.println("dupe " + scope); } } System.out.println(scopes); }</technical_language>

Target:
private NewTableConfiguration attachIteratorToNewTable(final CommandLine cl, final Shell shellState, NewTableConfiguration ntc) { EnumSet<IteratorScope> scopeEnumSet; IteratorSetting iteratorSetting; if (shellState.iteratorProfiles.size() == 0) throw new IllegalArgumentException("No shell iterator profiles have been created."); String[] options = cl.getOptionValues(createTableOptIteratorProps.getOpt()); for (String profileInfo : options) { String[] parts = profileInfo.split(":", 2); String profileName = parts[0]; try { iteratorSetting = shellState.iteratorProfiles.get(profileName).get(0); } catch (NullPointerException ex) { throw new IllegalArgumentException("invalid iterator argument. Either profile does not exist or unexpected spaces in argument list.", ex); } if (parts.length == 1) { scopeEnumSet = EnumSet.allOf(IteratorScope.class); } else { List<String> scopeArgs = Arrays.asList(parts[1].split(",")); if (scopeArgs.size() > 3) throw new IllegalArgumentException("Too many scope arguments supplied"); if (scopeArgs.contains("all")) { if (scopeArgs.size() > 1) throw new IllegalArgumentException("Cannot use 'all' in conjunction with other scopes"); scopeEnumSet = EnumSet.allOf(IteratorScope.class); } else { scopeEnumSet = validateScopes(scopeArgs); } } ntc.attachIterator(iteratorSetting, scopeEnumSet); } return ntc; }