Merge pull request #3021 from MJ10/master

Fix: import/export maintains account order
This commit is contained in:
cketti 2018-01-02 15:29:15 +01:00 committed by GitHub
commit f1deeb76d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -155,7 +156,7 @@ public class SettingsExporter {
Set<String> exportAccounts;
if (accountUuids == null) {
List<Account> accounts = preferences.getAccounts();
exportAccounts = new HashSet<>();
exportAccounts = new LinkedHashSet<>();
for (Account account : accounts) {
exportAccounts.add(account.getUuid());
}

View file

@ -7,6 +7,7 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -804,7 +805,7 @@ public class SettingsImporter {
String element = xpp.getName();
if (SettingsExporter.ACCOUNT_ELEMENT.equals(element)) {
if (accounts == null) {
accounts = new HashMap<>();
accounts = new LinkedHashMap<>();
}
ImportedAccount account = parseAccount(xpp, accountUuids, overview);