public List<String> list() { List<String> result = new LinkedList<>(); for (String key : currentTable.keySet()) { result.add(key); } return result; }
public void execute(String[] args, FileMap fileMap) throws MyException { if (args.length > 1) { throw new MyException("list: too many arguments"); } int i = 0; for (String string : fileMap.keySet()) { if (i != 0) { System.out.print(", "); } System.out.print(string); ++i; } System.out.println(); }