Made scan method static

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
Jim Martens 2017-06-26 18:08:33 +02:00
parent adf79f425e
commit 5a18e14ff1
1 changed files with 3 additions and 2 deletions

View File

@ -9,13 +9,14 @@ import java.util.Scanner;
public class CSVScanner {
/**
* Scans the sales.csv file.
* @param file the filename of the csv file
* @return a list of csv entries
* @throws FileNotFoundException if file doesn't exist
*/
public List<List<String>> scan() throws FileNotFoundException {
public static List<List<String>> scan(String file) throws FileNotFoundException {
List<List<String>> entries = new ArrayList<>();
Scanner scanner = new Scanner(new File("sales.csv"));
Scanner scanner = new Scanner(new File(file));
while (scanner.hasNextLine()) {
List<String> line = new ArrayList<>();
String line_str = scanner.nextLine();