So if I have loop like this
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
String[] parts = line.split(",");
if (parts.length >= 9) {
String equipmentDescr = parts[0];
...
}
will at X + 1 iteration data that was stored in X iteration be erased, like it will not be in the memory? For example what was stored in line or equipmentDescr at X iteration, will it be still at memory at X + 1 iteration?
So I am doing work of getting data from CSV file and saving it to database, I first did saved data from CSV file into objects at for that I needed 700mb. I thought that if I do not save data into objects but insert data into database as I loop I will save up on memory, but I did not, so I guess for instance what was stored in X iteration at line or parts will not be completely erased at memory at X + 1 or X + 2 iteration