From cd852c72c580b97deb99ac39c3087826265bfc21 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Mon, 11 Jan 2016 14:47:25 -0500 Subject: [PATCH] launchbar: use LinkedHashMap to avoid random order order of targets returned by target manager some-what important, use linked hash maps everywhere to avoid randomness of hashmap Change-Id: I670859854f10006c8591c3ebaa8f036d3127b5b8 --- .../core/internal/target/LaunchTargetManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.launchbar.core/src/org/eclipse/launchbar/core/internal/target/LaunchTargetManager.java b/bundles/org.eclipse.launchbar.core/src/org/eclipse/launchbar/core/internal/target/LaunchTargetManager.java index d485a0d130c..5ad555d9974 100644 --- a/bundles/org.eclipse.launchbar.core/src/org/eclipse/launchbar/core/internal/target/LaunchTargetManager.java +++ b/bundles/org.eclipse.launchbar.core/src/org/eclipse/launchbar/core/internal/target/LaunchTargetManager.java @@ -8,7 +8,7 @@ package org.eclipse.launchbar.core.internal.target; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -35,7 +35,7 @@ public class LaunchTargetManager implements ILaunchTargetManager { private Map> targets; private Map typeElements; - private Map typeProviders = new HashMap<>(); + private Map typeProviders = new LinkedHashMap<>(); private List listeners = new LinkedList<>(); private static final String DELIMETER1 = ","; //$NON-NLS-1$ @@ -49,7 +49,7 @@ public class LaunchTargetManager implements ILaunchTargetManager { private synchronized void initTargets() { if (targets == null) { // load target type elements from registry - typeElements = new HashMap<>(); + typeElements = new LinkedHashMap<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry .getExtensionPoint(Activator.getDefault().getBundle().getSymbolicName() + ".launchTargetTypes"); //$NON-NLS-1$ @@ -63,13 +63,13 @@ public class LaunchTargetManager implements ILaunchTargetManager { } // load targets from preference store - targets = new HashMap<>(); + targets = new LinkedHashMap<>(); Preferences prefs = getTargetsPref(); try { for (String typeId : prefs.keys()) { Map type = targets.get(typeId); if (type == null) { - type = new HashMap<>(); + type = new LinkedHashMap<>(); targets.put(typeId, type); } @@ -160,7 +160,7 @@ public class LaunchTargetManager implements ILaunchTargetManager { initTargets(); Map type = targets.get(typeId); if (type == null) { - type = new HashMap<>(); + type = new LinkedHashMap<>(); targets.put(typeId, type); }