I am using a file as Input in program...The file contains round about 1,00,000 lines .My program after each iteration takes a data from that file at process it. My Question is when a particular data is used once it will not be used any further .In one word i want to skip that data in the subsequent iteration... My solution was to copy the data that was not used is copied in another temporary file and that file is renamed to the original file .Here the time complexity increases rapidly and I want to avoid it.. Thanks for the reply in advance!!!!
There is not method to remove the line without using the temp file. Since you are processing a big file you can't use the temp file. The better way is to read file line by line and the process the data.
You may also store the line no as parameter in your program and the process the remaining lines your program.
View the tutorial of Reading file line by line.
your suggestion is to store the line-no in a arraylist an then each time it will check whether the lone number in the ArrayList or NOT!...