Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-06-18 05:13:45 -0400
committerLars Vogel2019-06-18 05:13:45 -0400
commite82ea939cc04c50f9291734add69d038c867f64a (patch)
treec866f89b9c7cfeb6c6d7a17b4cfe15d049a92d68 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal
parentc642e98e154c4b8b34d3cab4023cee1ad2f3cb35 (diff)
downloadeclipse.platform.debug-e82ea939cc04c50f9291734add69d038c867f64a.tar.gz
eclipse.platform.debug-e82ea939cc04c50f9291734add69d038c867f64a.tar.xz
eclipse.platform.debug-e82ea939cc04c50f9291734add69d038c867f64a.zip
Use addAll, deleteAll instead of looping through a collectionI20190620-0130I20190619-1820I20190619-1800I20190618-1805
Change-Id: I9c95900ed1b6e8823bb30c4ded37f214a92deffc Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java9
23 files changed, 45 insertions, 76 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
index 815fd8568..c2c58f5f0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.actions;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -118,9 +119,7 @@ public class ConfigureColumnsAction extends Action implements IUpdate {
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONFIGURE_COLUMNS_DIALOG);
String[] visibleColumns = fViewer.getVisibleColumns();
List<String> initialSelection = new ArrayList<>(visibleColumns.length);
- for (int i = 0; i < visibleColumns.length; i++) {
- initialSelection.add(visibleColumns[i]);
- }
+ Collections.addAll(initialSelection, visibleColumns);
dialog.setTitle(ActionMessages.ConfigureColumnsAction_2);
dialog.setInitialElementSelections(initialSelection);
if (dialog.open() == Window.OK) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
index 53a3c1863..975edde5a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -81,9 +82,7 @@ public class CopyBreakpointsActionDelegate extends VirtualCopyToClipboardActionD
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
if (selection instanceof IStructuredSelection) {
Set<IBreakpoint> removed = new HashSet<>();
- for (int i = 0; i < breakpoints.length; i++) {
- removed.add(breakpoints[i]);
- }
+ Collections.addAll(removed, breakpoints);
boolean modified = false;
List<Object> remain = new ArrayList<>();
IStructuredSelection ss = (IStructuredSelection) selection;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
index 83d7618eb..a4acc0685 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.actions.breakpoints;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -118,9 +119,7 @@ public class RemoveBreakpointAction extends AbstractSelectionActionDelegate {
}
if(deleteAll) {
IBreakpoint[] breakpoints = bpc.getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- breakpointsToDelete.add(breakpoints[i]);
- }
+ Collections.addAll(breakpointsToDelete, breakpoints);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
index e7bdbb370..9bafdd7f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
@@ -18,6 +18,7 @@ package org.eclipse.debug.internal.ui.actions.breakpoints;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -197,9 +198,7 @@ public class ShowSupportedBreakpointsAction extends ToggleFilterAction implement
debugTargets.add(((IDebugElement)next).getDebugTarget());
} else if (next instanceof ILaunch) {
IDebugTarget[] targets= ((ILaunch)next).getDebugTargets();
- for (int j = 0; j < targets.length; j++) {
- debugTargets.add(targets[j]);
- }
+ Collections.addAll(debugTargets, targets);
} else if (next instanceof IProcess) {
IDebugTarget target= ((IProcess)next).getAdapter(IDebugTarget.class);
if (target != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
index de2720db6..6587d6230 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.contextlaunching;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -498,9 +499,7 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
voteDefault++;
} else {
if(cfgs.length > 0) {
- for(int j = 0; j < cfgs.length; j++) {
- configs.add(cfgs[j]);
- }
+ Collections.addAll(configs, cfgs);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index 32b183cf8..a1bd7991f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -18,6 +18,7 @@ package org.eclipse.debug.internal.ui.elements.adapters;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Vector;
import org.eclipse.core.runtime.CoreException;
@@ -359,9 +360,7 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
if (memoryBuffer.length < reqNumBytes) {
ArrayList<MemoryByte> newBuffer = new ArrayList<>();
- for (int i = 0; i < memoryBuffer.length; i++) {
- newBuffer.add(memoryBuffer[i]);
- }
+ Collections.addAll(newBuffer, memoryBuffer);
for (int i = memoryBuffer.length; i < reqNumBytes; i++) {
MemoryByte mb = new MemoryByte();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
index 533a342ee..ea34ebbf3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
@@ -15,6 +15,7 @@
package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -173,9 +174,7 @@ public class EmbeddedBreakpointsViewer {
private void getBreakpointsFromContainers(IBreakpointContainer container, ArrayList<IBreakpoint> list) {
IBreakpoint[] bps = container.getBreakpoints();
list.ensureCapacity(list.size() + bps.length);
- for (int j = 0; j < bps.length; j++) {
- list.add(bps[j]);
- }
+ Collections.addAll(list, bps);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
index 5779bf0b8..75f5914c4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.launchConfigurations;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -326,9 +327,7 @@ public class FavoritesDialog extends TrayDialog {
* Copies the array into the list
*/
protected void addAll(ILaunchConfiguration[] array, List<ILaunchConfiguration> list) {
- for (int i = 0; i < array.length; i++) {
- list.add(array[i]);
- }
+ Collections.addAll(list, array);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index ddb52e0f9..1898e7821 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -778,9 +778,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
}
//copy into collection for hashcode matching
HashSet<String> typeset = new HashSet<>(ctypes.length);
- for(int i = 0; i < ctypes.length; i++) {
- typeset.add(ctypes[i]);
- }
+ Collections.addAll(typeset, ctypes);
ILaunchConfiguration[] configurations = filterConfigs(getLaunchManager().getLaunchConfigurations());
ILaunchConfiguration configuration = null;
IResource[] resrcs = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
index 24bef0588..f45c6287d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -168,9 +169,7 @@ public class LaunchConfigurationTabGroupWrapper implements ILaunchConfigurationT
}
else {
ILaunchConfigurationTab[] tabs = fGroup.getTabs();
- for(int i = 0; i < tabs.length; i++) {
- fTabs.add(tabs[i]);
- }
+ Collections.addAll(fTabs, tabs);
}
}
catch (CoreException ce) {DebugUIPlugin.log(ce);}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
index 32c8f0a47..556fb9ef2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
@@ -17,6 +17,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -93,9 +94,7 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
}
}
ILaunchConfiguration[] prototypes = getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.PROTOTYPE);
- for (ILaunchConfiguration prototype : prototypes) {
- configs.add(prototype);
- }
+ Collections.addAll(configs, prototypes);
return configs.toArray(new ILaunchConfiguration[0]);
} else {
return getLaunchManager().getLaunchConfigurationTypes();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index 308b17848..aec237318 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -18,6 +18,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -1254,9 +1255,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
ArrayList<String> list = new ArrayList<>();
String[] persisted = value.split(DELIMITER);
- for(int i = 0; i < persisted.length; i++) {
- list.add(persisted[i]);
- }
+ Collections.addAll(list, persisted);
String type = IInternalDebugCoreConstants.EMPTY_STRING;
//if the item is not in the list and is expanded add it, otherwise if it
//is not expanded do a remove...either way for the else we query the list
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
index d0a952f4e..eb106a6d9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
@@ -431,9 +431,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
IBreakpoint[] breakpoints = thread.getBreakpoints();
Set<IBreakpoint> bpsSet = new HashSet<>(breakpoints.length * 4 / 3);
- for (int i = 0; i< breakpoints.length; i++) {
- bpsSet.add(breakpoints[i]);
- }
+ Collections.addAll(bpsSet, breakpoints);
ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
synchronized (this) {
@@ -881,9 +879,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
debugTargets.add(((IDebugElement)next).getDebugTarget());
} else if (next instanceof ILaunch) {
IDebugTarget[] targets = ((ILaunch)next).getDebugTargets();
- for (int j = 0; j < targets.length; j++) {
- debugTargets.add(targets[j]);
- }
+ Collections.addAll(debugTargets, targets);
} else if (next instanceof IProcess) {
IDebugTarget target = ((IProcess)next).getAdapter(IDebugTarget.class);
if (target != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
index 6273ec907..7ce9ef61d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.sourcelookup;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -96,9 +97,7 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
protected List<ISourceContainer> getEntriesAsList() {
ISourceContainer[] entries = getViewer().getEntries();
List<ISourceContainer> list = new ArrayList<>(entries.length);
- for (int i = 0; i < entries.length; i++) {
- list.add(entries[i]);
- }
+ Collections.addAll(list, entries);
return list;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
index b47f2125e..c0687f085 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.viewers;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -60,9 +61,7 @@ class ChildrenRequestMonitor extends AsynchronousRequestMonitor implements IChil
@Override
public void addChildren(Object[] children) {
synchronized (fChildren) {
- for (int i = 0; i < children.length; i++) {
- fChildren.add(children[i]);
- }
+ Collections.addAll(fChildren, children);
}
scheduleViewerUpdate(0);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
index 3bc99b786..bf8bd98df 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
@@ -16,6 +16,7 @@
package org.eclipse.debug.internal.ui.viewers.model;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -1593,9 +1594,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
Tree tree = (Tree) getControl();
TreeItem[] selection = tree.getSelection();
Set<TreeItem> set = new HashSet<>();
- for (int i = 0; i < selection.length; i++) {
- set.add(selection[i]);
- }
+ Collections.addAll(set, selection);
TreeItem[] items = null;
Widget w = internalGetWidgetToSelect(path);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
index 830bdf862..a722be5aa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
@@ -17,6 +17,7 @@ package org.eclipse.debug.internal.ui.viewers.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1448,9 +1449,7 @@ public class InternalVirtualTreeModelViewer extends Viewer
VirtualTree tree = getTree();
VirtualItem[] selection = tree.getSelection();
Set<VirtualItem> set = new HashSet<>();
- for (int i = 0; i < selection.length; i++) {
- set.add(selection[i]);
- }
+ Collections.addAll(set, selection);
VirtualItem[] items = null;
VirtualItem parent = findItem(path);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index d779b026d..23cbced2d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -1003,9 +1003,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
DebugContextViewBindings bindings= fContextIdsToBindings.get(contextsIds.get(i));
if (bindings != null) {
String[] bindingViewIds = bindings.getAllViewBindingsIds();
- for (int j = 0; j < bindingViewIds.length; j++) {
- viewIds.add(bindingViewIds[j]);
- }
+ Collections.addAll(viewIds, bindingViewIds);
}
}
return viewIds;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
index a643263f8..3488c24c9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.views.breakpoints;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -598,9 +599,7 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
BreakpointContainer container = containers[i];
BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
if (subcontainers != null) {
- for (int j = 0; j < subcontainers.length; j++) {
- list.add(subcontainers[j]);
- }
+ Collections.addAll(list, subcontainers);
}
}
return list.toArray(new BreakpointContainer[list.size()]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
index 7973227aa..9d8d08d08 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.views.breakpoints;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -399,9 +400,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
IAdaptable[] elements = set.getElements();
List<IAdaptable> list = new ArrayList<>(elements.length);
- for (int i = 0; i < elements.length; i++) {
- list.add(elements[i]);
- }
+ Collections.addAll(list, elements);
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
fCache.removeMappedEntry(breakpoint.getMarker(), set.getName());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
index 950cd9f15..3dd39e4df 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.views.console;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.debug.core.DebugPlugin;
@@ -90,9 +91,7 @@ public class ConsoleTerminateAction extends Action implements IUpdate {
IProcess process2 = processes[j];
if (process2.equals(process)) {
IDebugTarget[] debugTargets = launch.getDebugTargets();
- for (int k = 0; k < debugTargets.length; k++) {
- targets.add(debugTargets[k]);
- }
+ Collections.addAll(targets, debugTargets);
return targets; // all possible targets have been terminated for the launch.
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index 4fd0f3547..f8c20fd79 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.views.memory.renderings;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
@@ -448,10 +449,7 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
{
ArrayList<MemoryByte> newBuffer = new ArrayList<>();
- for (int i=0; i<memoryBuffer.length; i++)
- {
- newBuffer.add(memoryBuffer[i]);
- }
+ Collections.addAll(newBuffer, memoryBuffer);
for (int i=memoryBuffer.length; i<reqNumBytes; i++)
{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
index f422b56b5..859bc9f3f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.views.memory.renderings;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
@@ -323,9 +324,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
ArrayList<MemoryByte> toReturn = new ArrayList<>();
for (int i = 0; i < segments.length; i++) {
MemoryByte[] temp = segments[i].getBytes();
- for (int j = 0; j < temp.length; j++) {
- toReturn.add(temp[j]);
- }
+ Collections.addAll(toReturn, temp);
}
return toReturn.toArray(new MemoryByte[0]);
}
@@ -405,9 +404,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
if (computeChanges()) {
Object[] newContent = compare(kids.toArray());
ArrayList<Object> newList = new ArrayList<>();
- for (int i = 0; i < newContent.length; i++) {
- newList.add(newContent[i]);
- }
+ Collections.addAll(newList, newContent);
super.setChildren(parentNode, newList);
} else {
super.setChildren(parentNode, kids);

Back to the top