The properties file defines key value pairs. All keys are unique, so they will not catch duplicate pairs. Instead, he will get the last matching pair. For example:
Example file:
a=1
b=2
c=3
d=4
a=10
c=7
The property class will return the last pairs ie
a=10
b=2
c=7
d=4
, , , , , arraylist.
ArrayList k = new ArrayList();
ArrayList v = new ArrayList();
Scanner scan = new Scanner(new File("E:\\abc.properties"));
while(scan.hasNextLine()) {
String split[] = scan.nextLine().trim().split("=");
if(split.length == 2) {
k.add(split[0]);
v.add(split[1]);
System.out.println("pair " + split[0] + ":" + split[1]);
}
}