I try to save/restore a set of string and all is working except one thing. When i create my strings i put :
Set<String> set = new HashSet<String>();
for(int i=0; i<toggles.size();i++){
set.add(toggles.get(i).serialise());
}
Order is for example "blutooth" "application" "data". When i get back set :
Set<String> set = prefs.getStringSet(key, new HashSet<String>());
for (String toggle : set){
Toggle t = new Toggle();
t.deserialize(toggle);
toggles.add(t);
}
I get "application" "bluetooth" "data" they are sort by name and i don't want this. I want to get same order i have save. Anyone can help me ?
This is not possible. Sets are unordered collections.