CommandLineArgs { public CommandLineArgs remove(String... args) { Map<String, String> copy = new HashMap<>(dashArgs); for (String arg : args) { copy.remove(arg); } return new CommandLineArgs(copy, normalArgs) { @Override protected void parseArguments(String[] args) { throw new IllegalStateException(); } }; } protected  CommandLineArgs(String[] args); protected  CommandLineArgs(Map<String, String> dashedArgs, List normalArgs); boolean hasArgument(String... paramList); String getArgument(String... paramList); String[] render(); CommandLineArgs remove(String... args); CommandLineArgs convertToNormal(String... args); static CommandLineArgs parse(String[] argv);  }
@Test public void testRemove() throws Exception { String[] argv = { "-config", "bootstrap.properties" }; String[] args = CommandLineArgs.parse(argv).remove("-config").render(); assertEquals(0, args.length); }