I have developed a java program that fetch data from .properties
file which has a huge number of lines. I was expecting that the program reads the data as it appears in the file, but I realized that there is some randomness in this process. So how java reads the lines of that file and is it guaranteed that there is no duplication in executing lines where each line will be read only once?
Thank you
Have a look at the documentation of Properties, showing that internally there's a hash table, and hash tables don't maintain the ordering of elements, but guarantee that there are no duplicate keys.
So, Java reads the lines in order but stores them in a data structure that doesn't keep that order.