Hey, @Pooja,
Before starting with anything you should know the path of the CSV file of the code:
private List<YourJavaItem> processInputFile(String inputFilePath) {
List<YourJavaItem> inputList = new ArrayList<YourJavaItem>();
try{
File inputF = new File(inputFilePath);
InputStream inputFS = new FileInputStream(inputF);
BufferedReader br = new BufferedReader(new InputStreamReader(inputFS));
// skip the header of the csv
inputList = br.lines().skip(1).map(mapToItem).collect(Collectors.toList());
br.close();
} catch (FileNotFoundException|IOException e) {
....
}
return inputList ;
}
Lines(): Which returns a stream object.
skip(1): That skips the first line in the CSV file