class SimpleCSVImporter {

	public List<CSVRow> importCSVFile(File file, int expectedColumnCount, int headlines) throws IOException {

		List<CSVRow> list = new ArrayList<>();

		try (BufferedReader br = new BufferedReader(new FileReader(file));) {
			String line = null;
			int lineNr=0;
			while ((line = br.readLine()) != null) {
				lineNr++;

				CSVRow row = CSVRow.importRow(line);
				int columnCount = row.columns.size();
				if (columnCount!=expectedColumnCount) {
					throw new IllegalStateException("Expected "+expectedColumnCount+" but got "+columnCount+" in line:"+lineNr);
				}
				if (lineNr>headlines) {
					list.add(row);
				}
			}
		}
		return list;

	}

}