Performance: HashMap replaceable with EnumMap
This commit is contained in:
parent
901827458f
commit
6f60a6298c
2 changed files with 5 additions and 3 deletions
|
@ -55,6 +55,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -473,7 +474,7 @@ public class SettingsHelper {
|
||||||
|
|
||||||
public List<SettingsItem> getFilteredSettingsItems(List<ExportSettingsType> settingsTypes, boolean globalExport) {
|
public List<SettingsItem> getFilteredSettingsItems(List<ExportSettingsType> settingsTypes, boolean globalExport) {
|
||||||
Map<ExportSettingsCategory, List<ExportDataObject>> dataList = getAdditionalData(globalExport);
|
Map<ExportSettingsCategory, List<ExportDataObject>> dataList = getAdditionalData(globalExport);
|
||||||
Map<ExportSettingsType, List<?>> typesMap = new HashMap<>();
|
Map<ExportSettingsType, List<?>> typesMap = new EnumMap<>(ExportSettingsType.class);
|
||||||
for (List<ExportDataObject> objects : dataList.values()) {
|
for (List<ExportDataObject> objects : dataList.values()) {
|
||||||
for (ExportDataObject exportObject : objects) {
|
for (ExportDataObject exportObject : objects) {
|
||||||
typesMap.put(exportObject.getType(), exportObject.getItems());
|
typesMap.put(exportObject.getType(), exportObject.getItems());
|
||||||
|
@ -828,7 +829,7 @@ public class SettingsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<ExportSettingsType, List<?>> getSettingsToOperate(List<SettingsItem> settingsItems, boolean importComplete) {
|
public static Map<ExportSettingsType, List<?>> getSettingsToOperate(List<SettingsItem> settingsItems, boolean importComplete) {
|
||||||
Map<ExportSettingsType, List<?>> settingsToOperate = new HashMap<>();
|
Map<ExportSettingsType, List<?>> settingsToOperate = new EnumMap<>(ExportSettingsType.class);
|
||||||
List<ApplicationModeBean> profiles = new ArrayList<>();
|
List<ApplicationModeBean> profiles = new ArrayList<>();
|
||||||
List<QuickAction> quickActions = new ArrayList<>();
|
List<QuickAction> quickActions = new ArrayList<>();
|
||||||
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
|
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
|
||||||
|
|
|
@ -76,6 +76,7 @@ import org.apache.commons.logging.Log;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -200,7 +201,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter = new ExportImportSettingsAdapter(app, nightMode, true);
|
adapter = new ExportImportSettingsAdapter(app, nightMode, true);
|
||||||
Map<ExportSettingsType, List<?>> itemsMap = new HashMap<>();
|
Map<ExportSettingsType, List<?>> itemsMap = new EnumMap<>(ExportSettingsType.class);
|
||||||
if (settingsItems != null) {
|
if (settingsItems != null) {
|
||||||
itemsMap = SettingsHelper.getSettingsToOperate(settingsItems, false);
|
itemsMap = SettingsHelper.getSettingsToOperate(settingsItems, false);
|
||||||
adapter.updateSettingsList(itemsMap);
|
adapter.updateSettingsList(itemsMap);
|
||||||
|
|
Loading…
Reference in a new issue