Made scan method static
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
adf79f425e
commit
5a18e14ff1
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue