package filmkolcsonzo; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.LinkedList; import java.util.Scanner; public class Kolcsonzo { private LinkedList films; public static void main(String[] args) throws FileNotFoundException { Kolcsonzo kolcsonzo = new Kolcsonzo(); kolcsonzo.populate(); } public Kolcsonzo() { films = new LinkedList<>(); } public void populate() throws FileNotFoundException { Scanner scanner = new Scanner(new FileInputStream("filmek.txt")); while (scanner.hasNext()) { String[] params = scanner.nextLine().split(";"); //Film if (params.length == 7) { films.add(new Film(params[1],params[2],Integer.parseInt(params[3]),Double.parseDouble(params[4]), Integer.parseInt(params[5]),Tipus.valueOf(params[6]))); } //AkcioFilm if (params.length == 8) { films.add(new AkcioFilm(params[1],params[2],Integer.parseInt(params[3]),Double.parseDouble(params[4]), Integer.parseInt(params[5]),Tipus.valueOf(params[6]),Integer.parseInt(params[7]))); } } scanner.close(); } }