diff options
author | Andrey Loskutov | 2017-07-12 14:18:59 +0000 |
---|---|---|
committer | Andrey Loskutov | 2017-07-12 14:18:59 +0000 |
commit | 16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e (patch) | |
tree | 9c378c38187cdd7d83049273f35d6e861bf7a1fa /bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java | |
parent | e7b6b39346529ae4262b502d6383cc6f8c27ba20 (diff) | |
download | rt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.tar.gz rt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.tar.xz rt.equinox.bundles-16ac0f7fcd3ec2db793fc077b2cc67b2dfa72c8e.zip |
Bug 519547 - generification for internal classes
Change-Id: Ie6c6ee7b34cf8184ab24b828aa9cde290a75ebc6
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java')
-rw-r--r-- | bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java index a4ea4a3a4..6eb87ccaf 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java @@ -32,11 +32,11 @@ public class CombinedEventDelta { // an empty array trail used to reduce re-allocations final static private int arrayGrowthSpace = 5; - private Map extensionsByID = null; // extension point ID -> List of Integer extensions IDs - private Map extPointsByID = null; // extension point ID -> List of Integer extension point IDs + private Map<String, List<Integer>> extensionsByID; // extension point ID -> List of Integer extensions IDs + private Map<String, List<Integer>> extPointsByID; // extension point ID -> List of Integer extension point IDs - private ArrayList allExtensions = null; // List of Integer IDs - private ArrayList allExtensionPoints = null; // List if Integer IDs + private List<Integer> allExtensions; // List of Integer IDs + private List<Integer> allExtensionPoints; // List if Integer IDs private CombinedEventDelta(boolean addition) { this.addition = addition; @@ -66,50 +66,54 @@ public class CombinedEventDelta { return objectManager; } - private List getExtensionsBucket(String id) { - if (extensionsByID == null) - extensionsByID = new HashMap(); - List extensions = (List) extensionsByID.get(id); + private List<Integer> getExtensionsBucket(String id) { + if (extensionsByID == null) { + extensionsByID = new HashMap<>(); + } + List<Integer> extensions = extensionsByID.get(id); if (extensions == null) { - extensions = new ArrayList(arrayGrowthSpace); + extensions = new ArrayList<>(arrayGrowthSpace); extensionsByID.put(id, extensions); } return extensions; } - private List getExtPointsBucket(String id) { - if (extPointsByID == null) - extPointsByID = new HashMap(); - List extensionPoints = (List) extPointsByID.get(id); + private List<Integer> getExtPointsBucket(String id) { + if (extPointsByID == null) { + extPointsByID = new HashMap<>(); + } + List<Integer> extensionPoints = extPointsByID.get(id); if (extensionPoints == null) { - extensionPoints = new ArrayList(arrayGrowthSpace); + extensionPoints = new ArrayList<>(arrayGrowthSpace); extPointsByID.put(id, extensionPoints); } return extensionPoints; } - private List getExtPointsGlobal() { - if (allExtensionPoints == null) - allExtensionPoints = new ArrayList(); + private List<Integer> getExtPointsGlobal() { + if (allExtensionPoints == null) { + allExtensionPoints = new ArrayList<>(); + } return allExtensionPoints; } - private List getExtensionsGlobal() { - if (allExtensions == null) - allExtensions = new ArrayList(); + private List<Integer> getExtensionsGlobal() { + if (allExtensions == null) { + allExtensions = new ArrayList<>(); + } return allExtensions; } public void rememberExtensionPoint(ExtensionPoint extensionPoint) { String bucketId = extensionPoint.getUniqueIdentifier(); - Object extPt = new Integer(extensionPoint.getObjectId()); + Integer extPt = new Integer(extensionPoint.getObjectId()); getExtPointsBucket(bucketId).add(extPt); getExtPointsGlobal().add(extPt); } public void rememberExtension(ExtensionPoint extensionPoint, int ext) { String bucketId = extensionPoint.getUniqueIdentifier(); - Object extension = new Integer(ext); + Integer extension = new Integer(ext); getExtensionsBucket(bucketId).add(extension); getExtensionsGlobal().add(extension); @@ -125,40 +129,41 @@ public class CombinedEventDelta { } public IExtensionPoint[] getExtensionPoints(String id) { - List extensionPoints = null; + List<Integer> extensionPoints = null; if (id != null && extPointsByID != null) - extensionPoints = (List) extPointsByID.get(id); + extensionPoints = extPointsByID.get(id); else if (id == null) extensionPoints = allExtensionPoints; if (extensionPoints == null) // no changes that fit the filter return null; int size = extensionPoints.size(); - ArrayList result = new ArrayList(size); + ArrayList<IExtensionPoint> result = new ArrayList<>(size); for (int i = 0; i < size; i++) { - Integer extPt = (Integer) extensionPoints.get(i); + Integer extPt = extensionPoints.get(i); IExtensionPoint extensionPoint = new ExtensionPointHandle(objectManager, extPt.intValue()); result.add(extensionPoint); } if (result.size() == 0) return null; - return (IExtensionPoint[]) result.toArray(new IExtensionPoint[result.size()]); + return result.toArray(new IExtensionPoint[result.size()]); } public IExtension[] getExtensions(String id) { - List extensions = null; - if (id != null && extensionsByID != null) - extensions = (List) extensionsByID.get(id); - else if (id == null) + List<Integer> extensions = null; + if (id != null && extensionsByID != null) { + extensions = extensionsByID.get(id); + } else if (id == null) { extensions = allExtensions; + } if (extensions == null) // no changes that fit the filter return null; int size = extensions.size(); - ArrayList result = new ArrayList(size); + ArrayList<IExtension> result = new ArrayList<>(size); for (int i = 0; i < size; i++) { - Integer ext = (Integer) extensions.get(i); + Integer ext = extensions.get(i); IExtension extension = new ExtensionHandle(objectManager, ext.intValue()); result.add(extension); } - return (IExtension[]) result.toArray(new IExtension[result.size()]); + return result.toArray(new IExtension[result.size()]); } } |