I tried this code but i'm getting error at List<String[]>
(in netbeans)
Error: "type List does not take parameters"
CSVReader csvReader = new CSVReader(new FileReader(new File("file.csv")));
List<String[]> list = csvReader.readAll();
String[][] dataArr = new String[list.size()][];
dataArr = list.toArray(dataArr);
Please any one help solving this problem.
You're using java.awt.List
that doesn't take a parameter - that's why you're getting "type List does not take parameters" error, you should use java.util.List
instead:
java.util.List<String[]> list = csvReader.readAll();
Or simply import from the correct package.
Assuming that you're using OpenCSV, the following works for me without an issue:
java.util.List<String[]> list = csvReader.readAll();
As per the comment already, this almost certainly means you're importing the wrong List class (so check your imports at the top of the source file.) The most likely mixup is java.awt.List.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With