fork download
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4.  
  5. public class ImplEmployeeParser implements EmployeeParser {
  6.  
  7. @Override
  8. public List<Employee> parse(Reader reader) throws IOException,NumberFormatException {
  9. HashMap<Integer,Employee> sets = new HashMap<Integer,Employee>();
  10. BufferedReader br = new BufferedReader(reader);
  11.  
  12. String line = "";
  13. while ((line = br.readLine()) != null) {
  14. String[] tokens = GetTokens(line);
  15.  
  16. Integer id = Integer.parseInt(tokens[0]);
  17. sets.put(id,new Employee(id,tokens[1],Integer.parseInt(tokens[2])));
  18. }
  19.  
  20. return new ArrayList<Employee>(sets.values());
  21. }
  22.  
  23. private String[] GetTokens(String line)
  24. {
  25. String[] tokens = line.split(",");
  26. for(int i = 0; i < tokens.length; i++)
  27. tokens[i] = tokens[i].trim().replaceAll("“|”","");
  28. return tokens;
  29. }
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:5: error: class ImplEmployeeParser is public, should be declared in a file named ImplEmployeeParser.java
public class ImplEmployeeParser implements EmployeeParser {
       ^
Main.java:5: error: cannot find symbol
public class ImplEmployeeParser implements EmployeeParser {
                                           ^
  symbol: class EmployeeParser
Main.java:8: error: cannot find symbol
	public List<Employee> parse(Reader reader) throws IOException,NumberFormatException {
	            ^
  symbol:   class Employee
  location: class ImplEmployeeParser
Main.java:9: error: cannot find symbol
		HashMap<Integer,Employee> sets = new HashMap<Integer,Employee>();
		                ^
  symbol:   class Employee
  location: class ImplEmployeeParser
Main.java:9: error: cannot find symbol
		HashMap<Integer,Employee> sets = new HashMap<Integer,Employee>();
		                                                     ^
  symbol:   class Employee
  location: class ImplEmployeeParser
Main.java:17: error: cannot find symbol
        	 sets.put(id,new Employee(id,tokens[1],Integer.parseInt(tokens[2])));
        	                 ^
  symbol:   class Employee
  location: class ImplEmployeeParser
Main.java:20: error: cannot find symbol
		return new ArrayList<Employee>(sets.values());
		                     ^
  symbol:   class Employee
  location: class ImplEmployeeParser
Main.java:7: error: method does not override or implement a method from a supertype
	@Override
	^
8 errors
stdout
Standard output is empty