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
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>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java5
-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
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java5
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java5
37 files changed, 78 insertions, 136 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
index 15b204aad..89f371ded 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.core.commands;
+import java.util.Collections;
import java.util.LinkedHashSet;
import org.eclipse.core.runtime.CoreException;
@@ -393,9 +394,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
return objects;
} else {
LinkedHashSet<Object> set = new LinkedHashSet<>(objects.length);
- for (int i = 0; i < objects.length; i++) {
- set.add(objects[i]);
- }
+ Collections.addAll(set, objects);
return set.toArray();
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
index 18b6b4131..c5585dd4d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
@@ -15,6 +15,7 @@
package org.eclipse.debug.core.model;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -337,9 +338,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
List<IProject> orderedProjects = new ArrayList<>(projects.length);
//Projects may not be in the build order but should be built if selected
List<IProject> unorderedProjects = new ArrayList<>(projects.length);
- for(int i = 0; i < projects.length; ++i) {
- unorderedProjects.add(projects[i]);
- }
+ Collections.addAll(unorderedProjects, projects);
for (int i = 0; i < orderedNames.length; i++) {
String projectName = orderedNames[i];
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
index fa55c48b7..50728d593 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.core.sourcelookup;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -66,9 +67,7 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
//it will only not be null when we care about duplicates
//saves the computation in isFindDuplicates()
if (results != null) {
- for (int j = 0; j < objects.length; j++) {
- results.add(objects[j]);
- }
+ Collections.addAll(results, objects);
} else {
if (objects.length == 1) {
return objects;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
index 420477cae..7799c478c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.core.sourcelookup.containers;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -80,9 +81,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
//it will only not be null when we care about duplicates
//saves the computation in isFindDuplicates()
if (results != null) {
- for (int j = 0; j < objects.length; j++) {
- results.add(objects[j]);
- }
+ Collections.addAll(results, objects);
} else {
if (objects.length == 1) {
return objects;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
index 0b21c4dc0..a7347bff9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.core.sourcelookup.containers;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.filesystem.EFS;
@@ -110,9 +111,7 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
// of canonical paths (fix to bug 95679 was removed).
IFile[] files = fRoot.findFilesForLocationURI(target.toURI());
if (isFindDuplicates() && files.length > 1) {
- for (int i = 0; i < files.length; i++) {
- sources.add(files[i]);
- }
+ Collections.addAll(sources, files);
} else if (files.length > 0) {
sources.add(files[0]);
}
@@ -130,9 +129,7 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
continue;
}
if (isFindDuplicates()) {
- for(int j=0; j < objects.length; j++) {
- sources.add(objects[j]);
- }
+ Collections.addAll(sources, objects);
} else {
sources.add(objects[0]);
break;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
index 55860c7d7..12bab3aa2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
@@ -15,6 +15,7 @@ package org.eclipse.debug.core.sourcelookup.containers;
import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -110,9 +111,7 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
continue;
}
if (isFindDuplicates()) {
- for(int j=0; j < objects.length; j++) {
- sources.add(objects[j]);
- }
+ Collections.addAll(sources, objects);
} else {
sources.add(objects[0]);
break;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
index 0c5f32a61..7259a4504 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
@@ -15,6 +15,7 @@
package org.eclipse.debug.core.sourcelookup.containers;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -91,9 +92,7 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
IProject[] projects = getAllReferencedProjects(project);
ISourceContainer[] folders = super.createSourceContainers();
List<ISourceContainer> all = new ArrayList<>(folders.length + projects.length);
- for (int i = 0; i < folders.length; i++) {
- all.add(folders[i]);
- }
+ Collections.addAll(all, folders);
for (int i = 0; i < projects.length; i++) {
if (project.exists() && project.isOpen()) {
ProjectSourceContainer container = new ProjectSourceContainer(projects[i], false);
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index d505c00e9..ddce2a193 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -1242,9 +1242,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IDebugTarget[] targets = null;
for (ILaunch launch : fLaunches) {
targets = launch.getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- allTargets.add(targets[i]);
- }
+ Collections.addAll(allTargets, targets);
}
return allTargets.toArray(new IDebugTarget[allTargets.size()]);
}
@@ -1840,9 +1838,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IProcess[] processes = null;
for (ILaunch launch : fLaunches) {
processes = launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- allProcesses.add(processes[i]);
- }
+ Collections.addAll(allProcesses, processes);
}
return allProcesses.toArray(new IProcess[allProcesses.size()]);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
index 396160866..fd03c0510 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.core;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -95,9 +96,7 @@ public class LogicalStructureManager {
// asks the logical structure providers
for (LogicalStructureProvider provider : fTypeProviders) {
ILogicalStructureType[] types = provider.getLogicalStructures(value);
- for (int i = 0; i < types.length; i++) {
- select.add(types[i]);
- }
+ Collections.addAll(select, types);
}
return select.toArray(new ILogicalStructureType[select.size()]);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
index 6092704ec..a2ecfb295 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
@@ -15,6 +15,7 @@
package org.eclipse.debug.internal.core;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -106,9 +107,7 @@ public class StepFilterManager implements ILaunchListener {
initialize();
List<IStepFilter> select = new ArrayList<>();
for (StepFilter extension : stepFilters) {
- for (IStepFilter stepFilter : extension.getStepFilters(modelIdentifier)) {
- select.add(stepFilter);
- }
+ Collections.addAll(select, extension.getStepFilters(modelIdentifier));
}
return select.toArray(new IStepFilter[select.size()]);
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
index 3f51c5d6f..24434287e 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.tests.expressions;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.debug.core.DebugPlugin;
@@ -71,25 +72,19 @@ public class ExpressionManagerTests extends AbstractDebugTest {
@Override
public void expressionsAdded(IExpression[] expressions) {
- for (int i = 0; i < expressions.length; i++) {
- added.add(expressions[i]);
- }
+ Collections.addAll(added, expressions);
addedCallbacks++;
}
@Override
public void expressionsRemoved(IExpression[] expressions) {
- for (int i = 0; i < expressions.length; i++) {
- removed.add(expressions[i]);
- }
+ Collections.addAll(removed, expressions);
removedCallbacks++;
}
@Override
public void expressionsChanged(IExpression[] expressions) {
- for (int i = 0; i < expressions.length; i++) {
- changed.add(expressions[i]);
- }
+ Collections.addAll(changed, expressions);
changedCallbacks++;
}
@@ -105,18 +100,14 @@ public class ExpressionManagerTests extends AbstractDebugTest {
@Override
public void expressionsMoved(IExpression[] expressions, int index) {
- for (int i = 0; i < expressions.length; i++) {
- moved.add(expressions[i]);
- }
+ Collections.addAll(moved, expressions);
movedCallbacks++;
insertIndex = index;
}
@Override
public void expressionsInserted(IExpression[] expressions, int index) {
- for (int i = 0; i < expressions.length; i++) {
- inserted.add(expressions[i]);
- }
+ Collections.addAll(inserted, expressions);
insertedCallbacks++;
insertIndex = index;
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
index af364ea97..a702ff4dc 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
@@ -26,6 +26,7 @@ import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1621,9 +1622,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Should be a prototype", prototype.isPrototype()); //$NON-NLS-1$
ILaunchConfiguration[] prototypes = wc.getType().getPrototypes();
List<ILaunchConfiguration> list = new ArrayList<>();
- for (int i = 0; i < prototypes.length; i++) {
- list.add(prototypes[i]);
- }
+ Collections.addAll(list, prototypes);
assertFalse("Expecting at least prototype", list.isEmpty()); //$NON-NLS-1$
assertTrue("Missing created prototype", list.contains(prototype)); //$NON-NLS-1$
}
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);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
index 5f72cd6cd..6a94c00bb 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
@@ -15,6 +15,7 @@
package org.eclipse.ui.console;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -378,9 +379,7 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
StyleRange[] partitionerStyles = ((IConsoleDocumentPartitioner) document.getDocumentPartitioner()).getStyleRanges(event.lineOffset, event.lineText.length());
if (partitionerStyles != null) {
- for (int i = 0; i < partitionerStyles.length; i++) {
- ranges.add(partitionerStyles[i]);
- }
+ Collections.addAll(ranges, partitionerStyles);
} else {
ranges.add(new StyleRange(offset, length, null, null));
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
index e483f439f..82f689608 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
@@ -16,6 +16,7 @@ package org.eclipse.ui.externaltools.internal.launchConfigurations;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -240,9 +241,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
fSpecificProjectsButton.setSelection(true);
IProject[] projects = getBuildProjects(configuration, IExternalToolConstants.ATTR_BUILD_SCOPE);
fProjects = new ArrayList<>(projects.length);
- for (int i = 0; i < projects.length; i++) {
- fProjects.add(projects[i]);
- }
+ Collections.addAll(fProjects, projects);
}
}
}

Back to the top