I have the following Ini-File
[Test]
a=1
b=2
a=3
and I need these key value pairs in the correct order. My problem is, I can find no way to achieve this. I tried the following three options:
Ini ini = new Ini(new File("test.ini"));
for (String sectionName : ini.keySet()) {
Section section = ini.get(sectionName);
//run through keyset
for (String key : section.keySet()) {
System.out.println(key + " = " + section.get(key));
}
System.out.println();
//run through all values
for (String key : section.keySet()) {
List<String> list = section.getAll(key);
for (String value : list) {
System.out.println(key + " = " + value);
}
}
System.out.println();
//run through entries
Set<Entry<String,String>> se = section.entrySet();
for(Entry<String,String> e:se){
System.out.println(e.getKey() + " = " + e.getValue());
}
}
but what I get is:
a = 3
b = 2
a = 1
a = 3
b = 2
b = 2
a = 3
None of this is in the correct Order or contains all values :(
//EDIT: Correct order should be like the ini-File:
a=1
b=2
a=3