diff options
author | Thomas Watson | 2011-10-12 21:18:51 +0000 |
---|---|---|
committer | Thomas Watson | 2011-10-12 21:18:51 +0000 |
commit | f5d0bdffb3d74ab7e89c865e251a5072112e86fd (patch) | |
tree | a94eb547f6aa81a17a65b9ca962e22aa92e97691 | |
parent | 89de09e1b109112f63a804161e896ecb2facf439 (diff) | |
download | rt.equinox.framework-f5d0bdffb3d74ab7e89c865e251a5072112e86fd.tar.gz rt.equinox.framework-f5d0bdffb3d74ab7e89c865e251a5072112e86fd.tar.xz rt.equinox.framework-f5d0bdffb3d74ab7e89c865e251a5072112e86fd.zip |
Bug 360732 - ArrayMap does not sort correctly if there are duplicatev20111017-1643
keys
-rw-r--r-- | bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ArrayMap.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ArrayMap.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ArrayMap.java index 0eb15e7fa..4cd862ae5 100644 --- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ArrayMap.java +++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ArrayMap.java @@ -164,11 +164,21 @@ public class ArrayMap<K, V> implements Collection<K>, Sortable<K> { Collections.sort(sortedKeys, comparator); List<V> sortedValues = new ArrayList<V>(sortedKeys.size()); for (K key : sortedKeys) { - sortedValues.add(get(key)); + sortedValues.add(getByIdentity(key)); } clear(); for (int i = 0; i < sortedKeys.size(); i++) { put(sortedKeys.get(i), sortedValues.get(i)); } } + + private V getByIdentity(K key) { + int index = 0; + for (K existing : keys) { + if (existing == key) + return getValue(index); + index++; + } + return null; + } } |