Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-09-25 15:58:32 -0400
committerAlexander Kurtakov2019-10-01 06:30:19 -0400
commit9603e432fe1bb1ae0a2e3270b87894b190e54246 (patch)
treeb60f09ba79b7f735f2ccf6dfa0abab3b8359cc1f
parent6a5d0185a2d01db8c0432c3d8df91026899def29 (diff)
downloadrt.equinox.p2-9603e432fe1bb1ae0a2e3270b87894b190e54246.tar.gz
rt.equinox.p2-9603e432fe1bb1ae0a2e3270b87894b190e54246.tar.xz
rt.equinox.p2-9603e432fe1bb1ae0a2e3270b87894b190e54246.zip
Use jdk 5 for-each loopI20191002-0100I20191001-1800
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I6f53dfa96efd01b94f2daef0fb8485cc27293003 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java7
5 files changed, 24 insertions, 17 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
index d78381be8..960214445 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
@@ -331,8 +331,9 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
// TODO: create an error
}
ITouchpointData[] touchpointData = (touchpointDataHandler == null ? new ITouchpointData[0] : touchpointDataHandler.getTouchpointData());
- for (int i = 0; i < touchpointData.length; i++)
- currentUnit.addTouchpointData(touchpointData[i]);
+ for (ITouchpointData touchpointData1 : touchpointData) {
+ currentUnit.addTouchpointData(touchpointData1);
+ }
if (updateDescriptorHandler != null)
currentUnit.setUpdateDescriptor(updateDescriptorHandler.getUpdateDescriptor());
units.add(currentUnit);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
index bb0ebce75..95036613e 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
@@ -223,9 +223,9 @@ public class MetadataWriter extends XMLWriter implements XMLConstants {
protected void writeApplicabilityScope(IRequirement[][] capabilities) {
start(APPLICABILITY_SCOPE);
- for (int i = 0; i < capabilities.length; i++) {
+ for (IRequirement[] capability : capabilities) {
start(APPLY_ON);
- writeRequirements(Arrays.asList(capabilities[i]));
+ writeRequirements(Arrays.asList(capability));
end(APPLY_ON);
}
end(APPLICABILITY_SCOPE);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java
index a6a638ec9..ddb6dfb04 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java
@@ -142,8 +142,9 @@ public class IUMap implements Cloneable {
}
public void addAll(IInstallableUnit[] toAdd) {
- for (int i = 0; i < toAdd.length; i++)
- add(toAdd[i]);
+ for (IInstallableUnit toAdd1 : toAdd) {
+ add(toAdd1);
+ }
}
public void addAll(Collection<IInstallableUnit> toAdd) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
index 76fb8378f..f07c91075 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
@@ -104,8 +104,9 @@ public class ResolvedInstallableUnit implements IInstallableUnit, IMemberProvide
return originalCapabilities;
ArrayList<IProvidedCapability> result = new ArrayList<>(originalCapabilities);
- for (int i = 0; i < fragments.length; i++)
- result.addAll(fragments[i].getProvidedCapabilities());
+ for (IInstallableUnitFragment fragment : fragments) {
+ result.addAll(fragment.getProvidedCapabilities());
+ }
return result;
}
@@ -116,8 +117,9 @@ public class ResolvedInstallableUnit implements IInstallableUnit, IMemberProvide
return originalCapabilities;
ArrayList<IRequirement> result = new ArrayList<>(originalCapabilities);
- for (int i = 0; i < fragments.length; i++)
- result.addAll(fragments[i].getRequirements());
+ for (IInstallableUnitFragment fragment : fragments) {
+ result.addAll(fragment.getRequirements());
+ }
return result;
}
@@ -128,8 +130,9 @@ public class ResolvedInstallableUnit implements IInstallableUnit, IMemberProvide
return originalCapabilities;
ArrayList<IRequirement> result = new ArrayList<>(originalCapabilities);
- for (int i = 0; i < fragments.length; i++)
- result.addAll(fragments[i].getMetaRequirements());
+ for (IInstallableUnitFragment fragment : fragments) {
+ result.addAll(fragment.getMetaRequirements());
+ }
return result;
}
@@ -140,8 +143,9 @@ public class ResolvedInstallableUnit implements IInstallableUnit, IMemberProvide
return originalTouchpointData;
ArrayList<ITouchpointData> result = new ArrayList<>(originalTouchpointData);
- for (int i = 0; i < fragments.length; i++)
- result.addAll(fragments[i].getTouchpointData());
+ for (IInstallableUnitFragment fragment : fragments) {
+ result.addAll(fragment.getTouchpointData());
+ }
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java
index 3f4b5d6b2..3eee416e7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java
@@ -818,9 +818,10 @@ public final class MetadataFactory {
}
private static ITouchpointType getCachedTouchpointType(String id, Version version) {
- for (int i = 0; i < typeCache.length; i++) {
- if (typeCache[i] != null && typeCache[i].getId().equals(id) && typeCache[i].getVersion().equals(version))
- return typeCache[i];
+ for (ITouchpointType typeCache1 : typeCache) {
+ if (typeCache1 != null && typeCache1.getId().equals(id) && typeCache1.getVersion().equals(version)) {
+ return typeCache1;
+ }
}
return null;
}

Back to the top