Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2009-12-30 01:00:51 +0000
committerThomas Hallgren2009-12-30 01:00:51 +0000
commit4ba177dba44bb476f42f63c297e42a44bf452d81 (patch)
treecf2bd3235f92dc513d8333e85d72680d77a6e66f
parent6e1bf0c21cf871111cdc4717b04824457bca9603 (diff)
downloadrt.equinox.p2-4ba177dba44bb476f42f63c297e42a44bf452d81.tar.gz
rt.equinox.p2-4ba177dba44bb476f42f63c297e42a44bf452d81.tar.xz
rt.equinox.p2-4ba177dba44bb476f42f63c297e42a44bf452d81.zip
298458: Add Java 5 Generics to the p2 code base (simplified for loops)
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java18
102 files changed, 376 insertions, 600 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
index 9302f74ce..ad94733ed 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
@@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.osgi.framework.*;
@@ -53,8 +54,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
repositoryManagerRegistration.unregister();
repositoryManagerRegistration = null;
synchronized (createdManagers) {
- for (Iterator<ArtifactRepositoryManager> it = createdManagers.keySet().iterator(); it.hasNext();) {
- ArtifactRepositoryManager manager = it.next();
+ for (ArtifactRepositoryManager manager : createdManagers.keySet()) {
manager.shutdown();
IProvisioningAgent agent = createdManagers.get(manager);
agent.unregisterService(IArtifactRepositoryManager.SERVICE_NAME, manager);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
index 1083d302e..d89486734 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
@@ -201,13 +201,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
if (removed) {
// we removed the child from the list so remove the associated repo object as well
ChildInfo found = null;
- for (Iterator<ChildInfo> iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
- ChildInfo current = iter.next();
+ for (ChildInfo current : loadedRepos) {
URI repoLocation = current.repo.getLocation();
- if (URIUtil.sameURI(childURI, repoLocation))
- found = current;
- else if (URIUtil.sameURI(other, repoLocation))
+ if (URIUtil.sameURI(childURI, repoLocation) || URIUtil.sameURI(other, repoLocation)) {
found = current;
+ break;
+ }
}
if (found != null)
loadedRepos.remove(found);
@@ -223,8 +222,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
public List<URI> getChildren() {
List<URI> result = new ArrayList<URI>();
- for (Iterator<URI> iter = childrenURIs.iterator(); iter.hasNext();)
- result.add(URIUtil.makeAbsolute(iter.next(), location));
+ for (URI uri : childrenURIs)
+ result.add(URIUtil.makeAbsolute(uri, location));
return result;
}
@@ -273,8 +272,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public boolean contains(IArtifactKey key) {
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = repositoryIterator.next();
+ for (ChildInfo current : loadedRepos) {
if (current.isGood() && current.repo.contains(key))
return true;
}
@@ -282,8 +280,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public boolean contains(IArtifactDescriptor descriptor) {
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = repositoryIterator.next();
+ for (ChildInfo current : loadedRepos) {
if (current.isGood() && current.repo.contains(descriptor))
return true;
}
@@ -292,8 +289,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
ArrayList<IArtifactDescriptor> result = new ArrayList<IArtifactDescriptor>();
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = repositoryIterator.next();
+ for (ChildInfo current : loadedRepos) {
if (current.isGood()) {
IArtifactDescriptor[] tempResult = current.repo.getArtifactDescriptors(key);
for (int i = 0; i < tempResult.length; i++)
@@ -306,8 +302,10 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
MultiStatus multiStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_childrenRepos, null);
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext() && requests.length > 0;) {
- IArtifactRepository current = repositoryIterator.next().repo;
+ for (ChildInfo childInfo : loadedRepos) {
+ if (requests.length == 0)
+ break;
+ IArtifactRepository current = childInfo.repo;
IArtifactRequest[] applicable = getRequestsForRepository(current, requests);
IStatus dlStatus = current.getArtifacts(applicable, subMonitor.newChild(requests.length));
multiStatus.add(dlStatus);
@@ -441,8 +439,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
*/
private boolean isSane(IArtifactRepository toCheckRepo, String comparatorID) {
IArtifactComparator comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorID);
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- IArtifactRepository current = repositoryIterator.next().repo;
+ for (ChildInfo childInfo : loadedRepos) {
+ IArtifactRepository current = childInfo.repo;
if (!current.equals(toCheckRepo)) {
if (!isSane(toCheckRepo, current, comparator))
return false;
@@ -519,26 +517,22 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// Query all the all the repositories this composite repo contains
List<IArtifactRepository> repos = new ArrayList<IArtifactRepository>();
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo info = repositoryIterator.next();
+ for (ChildInfo info : loadedRepos) {
if (info.isGood())
repos.add(info.repo);
}
- @SuppressWarnings("unchecked")
- CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(repos.toArray(new IQueryable[repos.size()]));
+ CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(repos);
return queryable.query(query, monitor);
}
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
// Query all the all the repositories this composite repo contains
List<IQueryable<IArtifactDescriptor>> repos = new ArrayList<IQueryable<IArtifactDescriptor>>();
- for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo info = repositoryIterator.next();
+ for (ChildInfo info : loadedRepos) {
if (info.isGood())
repos.add(info.repo.descriptorQueryable());
}
- @SuppressWarnings("unchecked")
- CompoundQueryable<IArtifactDescriptor> queryable = new CompoundQueryable<IArtifactDescriptor>(repos.toArray(new IQueryable[repos.size()]));
+ CompoundQueryable<IArtifactDescriptor> queryable = new CompoundQueryable<IArtifactDescriptor>(repos);
return queryable;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
index cd795e85f..8abc42745 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
@@ -12,7 +12,6 @@ package org.eclipse.equinox.internal.p2.artifact.repository.simple;
import java.io.*;
import java.net.URI;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.URIUtil;
@@ -94,8 +93,8 @@ public class BlobStore {
* Delete all of the blobs in the given set.
*/
public void deleteBlobs(Set<byte[]> set) {
- for (Iterator<byte[]> i = set.iterator(); i.hasNext();)
- deleteBlob(i.next());
+ for (byte[] blob : set)
+ deleteBlob(blob);
}
public URI fileFor(byte[] uuid) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 5dd8240b2..233e49d05 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -262,8 +262,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
super(name, type, version, null, description, provider, properties);
this.artifactDescriptors.addAll(artifacts);
this.mappingRules = mappingRules;
- for (Iterator<SimpleArtifactDescriptor> it = artifactDescriptors.iterator(); it.hasNext();)
- mapDescriptor(it.next());
+ for (SimpleArtifactDescriptor desc : artifactDescriptors)
+ mapDescriptor(desc);
}
private void mapDescriptor(IArtifactDescriptor descriptor) {
@@ -328,8 +328,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
internal.setRepositoryProperty(ARTIFACT_FOLDER, Boolean.TRUE.toString());
if (descriptor instanceof SimpleArtifactDescriptor) {
Map<String, String> repoProperties = ((SimpleArtifactDescriptor) descriptor).getRepositoryProperties();
- for (Iterator<Entry<String, String>> iterator = repoProperties.entrySet().iterator(); iterator.hasNext();) {
- Entry<String, String> entry = iterator.next();
+ for (Entry<String, String> entry : repoProperties.entrySet()) {
internal.setRepositoryProperty(entry.getKey(), entry.getValue());
}
}
@@ -625,8 +624,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
if (descriptors == null)
return null;
- for (Iterator<IArtifactDescriptor> iterator = descriptors.iterator(); iterator.hasNext();) {
- IArtifactDescriptor desc = iterator.next();
+ for (IArtifactDescriptor desc : descriptors) {
// look for a descriptor that matches the key and is "complete"
if (desc.getArtifactKey().equals(key) && desc.getProcessingSteps().length == 0)
return desc;
@@ -796,9 +794,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
this.location = repoLocation;
blobStore = new BlobStore(getBlobStoreLocation(repoLocation), 128);
initializeMapper();
- for (Iterator<SimpleArtifactDescriptor> i = artifactDescriptors.iterator(); i.hasNext();) {
- i.next().setRepository(this);
- }
+ for (SimpleArtifactDescriptor desc : artifactDescriptors)
+ desc.setRepository(this);
}
private synchronized void initializeMapper() {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
index b08652d13..686bd2192 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
@@ -177,8 +177,7 @@ public class SimpleArtifactRepositoryIO {
private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) {
start(ARTIFACTS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size());
- for (Iterator<SimpleArtifactDescriptor> iter = artifactDescriptors.iterator(); iter.hasNext();) {
- SimpleArtifactDescriptor descriptor = iter.next();
+ for (SimpleArtifactDescriptor descriptor : artifactDescriptors) {
IArtifactKey key = descriptor.getArtifactKey();
start(ARTIFACT_ELEMENT);
attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier());
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
index 5c1d62131..c00ed40e0 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
@@ -186,10 +186,10 @@ public class ProvCommandProvider implements CommandProvider {
return;
}
String environments = interpreter.nextArgument();
- Properties props = new Properties();
- props.setProperty(IProfile.PROP_INSTALL_FOLDER, location);
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IProfile.PROP_INSTALL_FOLDER, location);
if (environments != null)
- props.setProperty(IProfile.PROP_ENVIRONMENTS, environments);
+ props.put(IProfile.PROP_ENVIRONMENTS, environments);
try {
ProvisioningHelper.addProfile(profileId, props);
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index 5115dc164..b6b3457ac 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -11,7 +11,8 @@
package org.eclipse.equinox.internal.p2.console;
import java.net.URI;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
@@ -95,7 +96,7 @@ public class ProvisioningHelper {
manager.removeRepository(location);
}
- public static IProfile addProfile(String profileId, Properties properties) throws ProvisionException {
+ public static IProfile addProfile(String profileId, Map<String, String> properties) throws ProvisionException {
IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null)
return null;
@@ -103,13 +104,7 @@ public class ProvisioningHelper {
if (profile != null)
return profile;
- Map profileProperties = new HashMap();
-
- for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
- String key = (String) it.next();
- profileProperties.put(key, properties.getProperty(key));
- }
-
+ Map<String, String> profileProperties = new HashMap<String, String>(properties);
if (profileProperties.get(IProfile.PROP_ENVIRONMENTS) == null) {
EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
if (info != null)
@@ -280,7 +275,7 @@ public class ProvisioningHelper {
public static IStatus uninstall(String unitId, String version, IProfile profile, IProgressMonitor progress) throws ProvisionException {
if (profile == null)
return null;
- IQueryResult units = profile.query(new InstallableUnitQuery(unitId, Version.create(version)), progress);
+ IQueryResult<IInstallableUnit> units = profile.query(new InstallableUnitQuery(unitId, Version.create(version)), progress);
if (units.isEmpty()) {
StringBuffer error = new StringBuffer();
error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
index 56caeab6c..2520f2d0d 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
@@ -193,8 +193,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map
UnmodifiableProperties(Map<String, String> properties) {
super();
- for (Iterator<Map.Entry<String, String>> iter = properties.entrySet().iterator(); iter.hasNext();) {
- Map.Entry<String, String> entry = iter.next();
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
super.put(entry.getKey(), entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
index 127003367..fb2fc4946 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
@@ -146,18 +146,18 @@ public class Application implements IApplication {
if (flavor == null)
flavor = System.getProperty("eclipse.p2.configurationFlavor", FLAVOR_DEFAULT); //$NON-NLS-1$
- Properties props = new Properties();
- props.setProperty(IProfile.PROP_INSTALL_FOLDER, destination.toOSString());
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IProfile.PROP_INSTALL_FOLDER, destination.toOSString());
if (bundlePool == null || bundlePool.equals(Messages.destination_commandline))
- props.setProperty(IProfile.PROP_CACHE, destination.toOSString());
+ props.put(IProfile.PROP_CACHE, destination.toOSString());
else
- props.setProperty(IProfile.PROP_CACHE, bundlePool);
+ props.put(IProfile.PROP_CACHE, bundlePool);
if (roamingProfile)
- props.setProperty(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
+ props.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
String env = getEnvironmentProperty();
if (env != null)
- props.setProperty(IProfile.PROP_ENVIRONMENTS, env);
+ props.put(IProfile.PROP_ENVIRONMENTS, env);
if (profileProperties != null) {
putProperties(profileProperties, props);
}
@@ -380,7 +380,7 @@ public class Application implements IApplication {
* @param pairs a comma separated list of tag=value pairs
* @param properties the collection into which the pairs are put
*/
- private void putProperties(String pairs, Properties properties) {
+ private void putProperties(String pairs, Map<String, String> properties) {
StringTokenizer tok = new StringTokenizer(pairs, ",", true); //$NON-NLS-1$
while (tok.hasMoreTokens()) {
String next = tok.nextToken().trim();
@@ -502,11 +502,9 @@ public class Application implements IApplication {
if (locations == null || locations.length == 0)
return ProvisioningHelper.getInstallableUnits((URI) null, query, nullMonitor);
- @SuppressWarnings("unchecked")
- IQueryable<IInstallableUnit>[] locationQueryables = new IQueryable[locations.length];
- for (int i = 0; i < locations.length; i++) {
- locationQueryables[i] = new LocationQueryable(locations[i]);
- }
+ List<IQueryable<IInstallableUnit>> locationQueryables = new ArrayList<IQueryable<IInstallableUnit>>(locations.length);
+ for (int i = 0; i < locations.length; i++)
+ locationQueryables.add(new LocationQueryable(locations[i]));
return new CompoundQueryable<IInstallableUnit>(locationQueryables).query(query, nullMonitor);
}
@@ -540,13 +538,15 @@ public class Application implements IApplication {
private String toString(Map<String, String> context) {
StringBuffer result = new StringBuffer();
- for (Iterator<String> iter = context.keySet().iterator(); iter.hasNext();) {
- String key = iter.next();
+ boolean first = true;
+ for (String key : context.keySet()) {
+ if (first)
+ first = false;
+ else
+ result.append(',');
result.append(key);
result.append('=');
result.append(context.get(key));
- if (iter.hasNext())
- result.append(',');
}
return result.toString();
}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index bfed367f8..b7ba128fd 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -236,10 +236,9 @@ public class DirectorApplication implements IApplication {
if (top == 0)
return getInstallableUnits(null, query, nullMonitor);
- @SuppressWarnings("unchecked")
- IQueryable<IInstallableUnit>[] locationQueryables = new IQueryable[top];
+ List<IQueryable<IInstallableUnit>> locationQueryables = new ArrayList<IQueryable<IInstallableUnit>>(top);
for (int i = 0; i < top; i++)
- locationQueryables[i] = new LocationQueryable(metadataRepositoryLocations.get(i));
+ locationQueryables.add(new LocationQueryable(metadataRepositoryLocations.get(i)));
return new CompoundQueryable<IInstallableUnit>(locationQueryables).query(query, nullMonitor);
}
@@ -470,9 +469,7 @@ public class DirectorApplication implements IApplication {
while (roots.hasNext())
allRoots.add(roots.next());
} else {
- Iterator<IVersionedId> r = rootsToList.iterator();
- while (r.hasNext()) {
- IVersionedId rootName = r.next();
+ for (IVersionedId rootName : rootsToList) {
Version v = rootName.getVersion();
IQuery<IInstallableUnit> query = new InstallableUnitQuery(rootName.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true));
Iterator<IInstallableUnit> roots = collectRootIUs(query).iterator();
@@ -482,9 +479,7 @@ public class DirectorApplication implements IApplication {
}
Collections.sort(allRoots);
- Iterator<IInstallableUnit> i = allRoots.iterator();
- while (i.hasNext()) {
- IInstallableUnit iu = i.next();
+ for (IInstallableUnit iu : allRoots) {
System.out.println(iu.getId() + '=' + iu.getVersion());
}
}
@@ -863,9 +858,7 @@ public class DirectorApplication implements IApplication {
private String toString(Map<String, String> context) {
StringBuffer result = new StringBuffer();
- Iterator<Entry<String, String>> entries = context.entrySet().iterator();
- while (entries.hasNext()) {
- Entry<String, String> entry = entries.next();
+ for (Entry<String, String> entry : context.entrySet()) {
if (result.length() > 0)
result.append(',');
result.append(entry.getKey());
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
index f22e580bc..db14b0818 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
@@ -25,13 +25,11 @@ public class AttachmentHelper {
Map<IInstallableUnit, IInstallableUnitFragment> fragmentBindings = new HashMap<IInstallableUnit, IInstallableUnitFragment>();
//Build a map inverse of the one provided in input (host --> List of fragments)
Map<IInstallableUnit, List<IInstallableUnitFragment>> iusToFragment = new HashMap<IInstallableUnit, List<IInstallableUnitFragment>>(fragmentsToIUs.size());
- for (Iterator<Entry<IInstallableUnitFragment, List<IInstallableUnit>>> iterator = fragmentsToIUs.entrySet().iterator(); iterator.hasNext();) {
- Entry<IInstallableUnitFragment, List<IInstallableUnit>> mapping = iterator.next();
+ for (Entry<IInstallableUnitFragment, List<IInstallableUnit>> mapping : fragmentsToIUs.entrySet()) {
IInstallableUnitFragment fragment = mapping.getKey();
List<IInstallableUnit> existingMatches = mapping.getValue();
- for (Iterator<IInstallableUnit> iterator2 = existingMatches.iterator(); iterator2.hasNext();) {
- IInstallableUnit host = iterator2.next();
+ for (IInstallableUnit host : existingMatches) {
List<IInstallableUnitFragment> potentialFragments = iusToFragment.get(host);
if (potentialFragments == null) {
potentialFragments = new ArrayList<IInstallableUnitFragment>();
@@ -41,13 +39,11 @@ public class AttachmentHelper {
}
}
- for (Iterator<Entry<IInstallableUnit, List<IInstallableUnitFragment>>> iterator = iusToFragment.entrySet().iterator(); iterator.hasNext();) {
- Entry<IInstallableUnit, List<IInstallableUnitFragment>> entry = iterator.next();
+ for (Entry<IInstallableUnit, List<IInstallableUnitFragment>> entry : iusToFragment.entrySet()) {
IInstallableUnit hostIU = entry.getKey();
List<IInstallableUnitFragment> potentialIUFragments = entry.getValue();
ArrayList<IInstallableUnitFragment> applicableFragments = new ArrayList<IInstallableUnitFragment>();
- for (Iterator<IInstallableUnitFragment> iterator2 = potentialIUFragments.iterator(); iterator2.hasNext();) {
- IInstallableUnitFragment potentialFragment = iterator2.next();
+ for (IInstallableUnitFragment potentialFragment : potentialIUFragments) {
if (hostIU.equals(potentialFragment))
continue;
@@ -72,8 +68,7 @@ public class AttachmentHelper {
IInstallableUnitFragment theFragment = null;
int specificityLevel = 0;
- for (Iterator<IInstallableUnitFragment> iterator4 = applicableFragments.iterator(); iterator4.hasNext();) {
- IInstallableUnitFragment fragment = iterator4.next();
+ for (IInstallableUnitFragment fragment : applicableFragments) {
if (fragment.getHost().length > specificityLevel) {
theFragment = fragment;
specificityLevel = fragment.getHost().length;
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
index 51ec7853d..fec8312a8 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
@@ -51,8 +51,7 @@ public class OperationGenerator {
//Note that despite the fact that they are the same, a different CU can be attached.
//The objects contained in the intersection are the one that were originally in the from collection.
TreeSet<IInstallableUnit> to = new TreeSet<IInstallableUnit>(to_);
- for (Iterator<IInstallableUnit> iterator = intersection.iterator(); iterator.hasNext();) {
- IInstallableUnit fromIU = iterator.next();
+ for (IInstallableUnit fromIU : intersection) {
IInstallableUnit toIU = to.tailSet(fromIU).first();
generateConfigurationOperation(fromIU, toIU, operations);
}
@@ -109,8 +108,7 @@ public class OperationGenerator {
Set<IInstallableUnit> removedFromTo = new HashSet<IInstallableUnit>();
Map<String, List<IInstallableUnit>> fromById = new HashMap<String, List<IInstallableUnit>>();
- for (Iterator<IInstallableUnit> iterator = from.iterator(); iterator.hasNext();) {
- IInstallableUnit iuFrom = iterator.next();
+ for (IInstallableUnit iuFrom : from) {
List<IInstallableUnit> ius = fromById.get(iuFrom.getId());
if (ius == null) {
ius = new ArrayList<IInstallableUnit>();
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
index 21ed85341..499439e51 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
@@ -108,8 +108,8 @@ public class Projector {
long stop = System.currentTimeMillis();
Tracing.debug("Explanation found: " + (stop - start)); //$NON-NLS-1$
Tracing.debug("Explanation:"); //$NON-NLS-1$
- for (Iterator<Explanation> i = explanation.iterator(); i.hasNext();) {
- Tracing.debug(i.next().toString());
+ for (Explanation ex : explanation) {
+ Tracing.debug(ex.toString());
}
}
} catch (TimeoutException e) {
@@ -210,8 +210,7 @@ public class Projector {
final BigInteger POWER = BigInteger.valueOf(2);
BigInteger maxWeight = POWER;
- for (Iterator<Entry<String, Map<Version, IInstallableUnit>>> iterator = s.iterator(); iterator.hasNext();) {
- Entry<String, Map<Version, IInstallableUnit>> entry = iterator.next();
+ for (Entry<String, Map<Version, IInstallableUnit>> entry : s) {
Map<Version, IInstallableUnit> conflictingEntries = entry.getValue();
if (conflictingEntries.size() == 1) {
continue;
@@ -232,16 +231,15 @@ public class Projector {
maxWeight = maxWeight.multiply(POWER);
// Weight the no-op variables beneath the abstract variables
- for (Iterator<AbstractVariable> iterator = noopVariables.values().iterator(); iterator.hasNext();) {
- weightedObjects.add(WeightedObject.newWO(iterator.next(), maxWeight));
- }
+ for (AbstractVariable var : noopVariables.values())
+ weightedObjects.add(WeightedObject.newWO(var, maxWeight));
maxWeight = maxWeight.multiply(POWER);
// Add the abstract variables
BigInteger abstractWeight = maxWeight.negate();
- for (Iterator<AbstractVariable> iterator = abstractVariables.iterator(); iterator.hasNext();) {
- weightedObjects.add(WeightedObject.newWO(iterator.next(), abstractWeight));
+ for (AbstractVariable var : abstractVariables) {
+ weightedObjects.add(WeightedObject.newWO(var, abstractWeight));
}
maxWeight = maxWeight.multiply(POWER);
@@ -279,8 +277,7 @@ public class Projector {
private void createObjectiveFunction(List<WeightedObject<? extends Object>> weightedObjects) {
if (DEBUG) {
StringBuffer b = new StringBuffer();
- for (Iterator<WeightedObject<? extends Object>> i = weightedObjects.iterator(); i.hasNext();) {
- WeightedObject<? extends Object> object = i.next();
+ for (WeightedObject<? extends Object> object : weightedObjects) {
if (b.length() > 0)
b.append(", "); //$NON-NLS-1$
b.append(object.getWeight());
@@ -579,14 +576,12 @@ public class Projector {
}
// Fix: now create the pending non-patch requirements based on the full set of patches
- for (Iterator<Pending> iterator = nonPatchedRequirements.values().iterator(); iterator.hasNext();) {
- Pending pending = iterator.next();
+ for (Pending pending : nonPatchedRequirements.values()) {
createImplication(pending.left, pending.matches, pending.explanation);
}
List<AbstractVariable> optionalAbstractRequirements = new ArrayList<AbstractVariable>();
- for (Iterator<Entry<IRequirement, List<IInstallableUnitPatch>>> iterator = unchangedRequirements.entrySet().iterator(); iterator.hasNext();) {
- Entry<IRequirement, List<IInstallableUnitPatch>> entry = iterator.next();
+ for (Entry<IRequirement, List<IInstallableUnitPatch>> entry : unchangedRequirements.entrySet()) {
List<IInstallableUnitPatch> patchesApplied = entry.getValue();
Iterator<IInstallableUnit> allPatches = applicablePatches.iterator();
List<IInstallableUnitPatch> requiredPatches = new ArrayList<IInstallableUnitPatch>();
@@ -714,8 +709,7 @@ public class Projector {
if (optionalRequirements.isEmpty())
return;
AbstractVariable noop = getNoOperationVariable(iu);
- for (Iterator<AbstractVariable> i = optionalRequirements.iterator(); i.hasNext();) {
- AbstractVariable abs = i.next();
+ for (AbstractVariable abs : optionalRequirements) {
createIncompatibleValues(abs, noop);
}
optionalRequirements.add(noop);
@@ -727,10 +721,8 @@ public class Projector {
if (DEBUG) {
Tracing.debug(name + ": " + left + "->" + right); //$NON-NLS-1$ //$NON-NLS-2$
}
- for (Iterator<?> iterator = right.iterator(); iterator.hasNext();) {
- dependencyHelper.implication(new Object[] {left}).impliesNot(iterator.next()).named(name);
- }
-
+ for (Object r : right)
+ dependencyHelper.implication(new Object[] {left}).impliesNot(r).named(name);
}
private void createImplication(Object left, List<?> right, Explanation name) throws ContradictionException {
@@ -759,8 +751,7 @@ public class Projector {
//When there is a mix of singleton and non singleton, several constraints are generated
private void createConstraintsForSingleton() throws ContradictionException {
Set<Entry<String, Map<Version, IInstallableUnit>>> s = slice.entrySet();
- for (Iterator<Entry<String, Map<Version, IInstallableUnit>>> iterator = s.iterator(); iterator.hasNext();) {
- Entry<String, Map<Version, IInstallableUnit>> entry = iterator.next();
+ for (Entry<String, Map<Version, IInstallableUnit>> entry : s) {
Map<Version, IInstallableUnit> conflictingEntries = entry.getValue();
if (conflictingEntries.size() < 2)
continue;
@@ -768,8 +759,7 @@ public class Projector {
Collection<IInstallableUnit> conflictingVersions = conflictingEntries.values();
List<IInstallableUnit> singletons = new ArrayList<IInstallableUnit>();
List<IInstallableUnit> nonSingletons = new ArrayList<IInstallableUnit>();
- for (Iterator<IInstallableUnit> conflictIterator = conflictingVersions.iterator(); conflictIterator.hasNext();) {
- IInstallableUnit iu = conflictIterator.next();
+ for (IInstallableUnit iu : conflictingVersions) {
if (iu.isSingleton()) {
singletons.add(iu);
} else {
@@ -785,8 +775,8 @@ public class Projector {
createAtMostOne(singletonArray);
} else {
singletonArray = singletons.toArray(new IInstallableUnit[singletons.size() + 1]);
- for (Iterator<IInstallableUnit> iterator2 = nonSingletons.iterator(); iterator2.hasNext();) {
- singletonArray[singletonArray.length - 1] = iterator2.next();
+ for (IInstallableUnit nonSingleton : nonSingletons) {
+ singletonArray[singletonArray.length - 1] = nonSingleton;
createAtMostOne(singletonArray);
}
}
@@ -870,8 +860,8 @@ public class Projector {
private void backToIU() {
solution = new ArrayList<IInstallableUnit>();
IVec<Object> sat4jSolution = dependencyHelper.getSolution();
- for (Iterator<Object> i = sat4jSolution.iterator(); i.hasNext();) {
- Object var = i.next();
+ for (Iterator<Object> iter = sat4jSolution.iterator(); iter.hasNext();) {
+ Object var = iter.next();
if (var instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) var;
if (iu == entryPoint)
@@ -886,8 +876,8 @@ public class Projector {
Collections.sort(l);
Tracing.debug("Solution:"); //$NON-NLS-1$
Tracing.debug("Numbers of IUs selected: " + l.size()); //$NON-NLS-1$
- for (Iterator<IInstallableUnit> iterator = l.iterator(); iterator.hasNext();) {
- Tracing.debug(iterator.next().toString());
+ for (IInstallableUnit s : l) {
+ Tracing.debug(s.toString());
}
}
@@ -927,14 +917,12 @@ public class Projector {
public Map<IInstallableUnitFragment, List<IInstallableUnit>> getFragmentAssociation() {
Map<IInstallableUnitFragment, List<IInstallableUnit>> resolvedFragments = new HashMap<IInstallableUnitFragment, List<IInstallableUnit>>(fragments.size());
- for (Iterator<Entry<IInstallableUnitFragment, Set<IInstallableUnit>>> iterator = fragments.entrySet().iterator(); iterator.hasNext();) {
- Entry<IInstallableUnitFragment, Set<IInstallableUnit>> fragment = iterator.next();
+ for (Entry<IInstallableUnitFragment, Set<IInstallableUnit>> fragment : fragments.entrySet()) {
if (!dependencyHelper.getBooleanValueFor(fragment.getKey()))
continue;
Set<IInstallableUnit> potentialHosts = fragment.getValue();
List<IInstallableUnit> resolvedHost = new ArrayList<IInstallableUnit>(potentialHosts.size());
- for (Iterator<IInstallableUnit> iterator2 = potentialHosts.iterator(); iterator2.hasNext();) {
- IInstallableUnit host = iterator2.next();
+ for (IInstallableUnit host : potentialHosts) {
if (dependencyHelper.getBooleanValueFor(host))
resolvedHost.add(host);
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
index eade59c72..fa82681d0 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
@@ -69,8 +69,7 @@ public class QueryableArray implements IQueryable<IInstallableUnit> {
return null;
Set<IInstallableUnit> matchingIUs = new HashSet<IInstallableUnit>();
- for (Iterator<IUCapability> iterator = iuCapabilities.iterator(); iterator.hasNext();) {
- IUCapability iuCapability = iterator.next();
+ for (IUCapability iuCapability : iuCapabilities) {
if (iuCapability.iu.satisfies(requiredCapability))
matchingIUs.add(iuCapability.iu);
}
@@ -82,8 +81,7 @@ public class QueryableArray implements IQueryable<IInstallableUnit> {
return;
namedCapabilityIndex = new HashMap<String, List<IUCapability>>();
- for (Iterator<IInstallableUnit> iterator = dataSet.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : dataSet) {
List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
int top = providedCapabilities.size();
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
index 59a35f38b..b3abf6c49 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
@@ -120,8 +120,7 @@ public class SimplePlanner implements IPlanner {
MultiStatus root = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Unsatisfied_Dependencies, null);
//try to find a more specific root message if possible
String specificMessage = null;
- for (Iterator<Explanation> it = explanations.iterator(); it.hasNext();) {
- final Explanation next = it.next();
+ for (Explanation next : explanations) {
root.add(next.toStatus());
if (specificMessage == null && next instanceof Explanation.MissingIU)
specificMessage = Messages.Explanation_rootMissing;
@@ -149,22 +148,15 @@ public class SimplePlanner implements IPlanner {
}
// Now deal with profile property changes/additions
Map<String, String> propertyChanges = profileChangeRequest.getPropertiesToAdd();
- Iterator<Entry<String, String>> iter = propertyChanges.entrySet().iterator();
- while (iter.hasNext()) {
- Entry<String, String> entry = iter.next();
+ for (Entry<String, String> entry : propertyChanges.entrySet()) {
operands.add(new PropertyOperand(entry.getKey(), existingProperties.get(entry.getKey()), entry.getValue()));
}
// Now deal with iu property changes/additions.
// TODO we aren't yet checking that the IU will exist in the final profile, will the engine do this?
Map<IInstallableUnit, Map<String, String>> allIUPropertyChanges = profileChangeRequest.getInstallableUnitProfilePropertiesToAdd();
- Iterator<Entry<IInstallableUnit, Map<String, String>>> allIter = allIUPropertyChanges.entrySet().iterator();
- while (allIter.hasNext()) {
- Entry<IInstallableUnit, Map<String, String>> entry = allIter.next();
+ for (Entry<IInstallableUnit, Map<String, String>> entry : allIUPropertyChanges.entrySet()) {
IInstallableUnit iu = entry.getKey();
- Map<String, String> iuPropertyChanges = entry.getValue();
- Iterator<Entry<String, String>> iuPropIter = iuPropertyChanges.entrySet().iterator();
- while (iuPropIter.hasNext()) {
- Entry<String, String> entry2 = iuPropIter.next();
+ for (Entry<String, String> entry2 : entry.getValue().entrySet()) {
Object oldValue = profile.getInstallableUnitProperty(iu, entry2.getKey());
operands.add(new InstallableUnitPropertyOperand(iu, entry2.getKey(), oldValue, entry2.getValue()));
}
@@ -172,14 +164,11 @@ public class SimplePlanner implements IPlanner {
// Now deal with iu property removals.
// TODO we could optimize by not generating property removals for IU's that aren't there or won't be there.
Map<IInstallableUnit, List<String>> allIUPropertyDeletions = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove();
- Iterator<Entry<IInstallableUnit, List<String>>> delItor = allIUPropertyDeletions.entrySet().iterator();
- while (delItor.hasNext()) {
- Entry<IInstallableUnit, List<String>> entry = delItor.next();
+ for (Entry<IInstallableUnit, List<String>> entry : allIUPropertyDeletions.entrySet()) {
IInstallableUnit iu = entry.getKey();
Map<String, String> existingIUProperties = profile.getInstallableUnitProperties(iu);
List<String> iuPropertyRemovals = entry.getValue();
- for (Iterator<String> it = iuPropertyRemovals.iterator(); it.hasNext();) {
- String key = it.next();
+ for (String key : iuPropertyRemovals) {
if (existingIUProperties.containsKey(key))
operands.add(new InstallableUnitPropertyOperand(iu, key, existingIUProperties.get(key), null));
}
@@ -236,8 +225,7 @@ public class SimplePlanner implements IPlanner {
}
}
if (context != null) {
- for (Iterator<IInstallableUnit> iter = context.getExtraIUs().iterator(); iter.hasNext();) {
- IInstallableUnit iu = iter.next();
+ for (IInstallableUnit iu : context.getExtraIUs()) {
String key = iu.getId() + '_' + iu.getVersion().toString();
resultsMap.put(key, iu);
}
@@ -401,8 +389,7 @@ public class SimplePlanner implements IPlanner {
//Verify that all the meta requirements necessary to perform the uninstallation (if necessary) and all t
private Collection<IRequirement> areMetaRequirementsSatisfied(IProfile oldProfile, Collection<IInstallableUnit> newProfile, IProvisioningPlan initialPlan) {
Collection<IRequirement> allMetaRequirements = extractMetaRequirements(newProfile, initialPlan);
- for (Iterator<IRequirement> iterator = allMetaRequirements.iterator(); iterator.hasNext();) {
- IRequirement requirement = iterator.next();
+ for (IRequirement requirement : allMetaRequirements) {
if (oldProfile.query(new LimitQuery<IInstallableUnit>(requirement.getMatches(), 1), null).isEmpty())
return allMetaRequirements;
}
@@ -412,8 +399,7 @@ public class SimplePlanner implements IPlanner {
//Return all the meta requirements for the list of IU specified and all the meta requirements listed necessary to satisfy the uninstallation
private Collection<IRequirement> extractMetaRequirements(Collection<IInstallableUnit> ius, IProvisioningPlan plan) {
Set<IRequirement> allMetaRequirements = new HashSet<IRequirement>();
- for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : ius) {
allMetaRequirements.addAll(iu.getMetaRequiredCapabilities());
}
IQueryResult<IInstallableUnit> queryResult = plan.getRemovals().query(InstallableUnitQuery.ANY, null);
@@ -493,8 +479,7 @@ public class SimplePlanner implements IPlanner {
//Create an agent request from the initial request
ProfileChangeRequest agentRequest = new ProfileChangeRequest(profile);
- for (Iterator<Entry<String, String>> it = initialRequest.getPropertiesToAdd().entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : initialRequest.getPropertiesToAdd().entrySet()) {
agentRequest.setProfileProperty(entry.getKey(), entry.getValue());
}
String[] removedProperties = initialRequest.getPropertiesToRemove();
@@ -502,11 +487,9 @@ public class SimplePlanner implements IPlanner {
agentRequest.removeProfileProperty(removedProperties[i]);
}
Map<IInstallableUnit, List<String>> removedIUProperties = initialRequest.getInstallableUnitProfilePropertiesToRemove();
- for (Iterator<Entry<IInstallableUnit, List<String>>> iterator = removedIUProperties.entrySet().iterator(); iterator.hasNext();) {
- Entry<IInstallableUnit, List<String>> entry = iterator.next();
- List<String> value = entry.getValue();
- for (Iterator<String> iterator2 = value.iterator(); iterator2.hasNext();) {
- agentRequest.removeInstallableUnitProfileProperty(entry.getKey(), iterator2.next());
+ for (Entry<IInstallableUnit, List<String>> entry : removedIUProperties.entrySet()) {
+ for (String propKey : entry.getValue()) {
+ agentRequest.removeInstallableUnitProfileProperty(entry.getKey(), propKey);
}
}
@@ -621,8 +604,7 @@ public class SimplePlanner implements IPlanner {
IInstallableUnit[] added = profileChangeRequest.getAddedInstallableUnits();
IInstallableUnit[] removed = profileChangeRequest.getRemovedInstallableUnits();
- for (Iterator<Entry<IInstallableUnit, List<String>>> iterator = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove().entrySet().iterator(); iterator.hasNext();) {
- Entry<IInstallableUnit, List<String>> object = iterator.next();
+ for (Entry<IInstallableUnit, List<String>> object : profileChangeRequest.getInstallableUnitProfilePropertiesToRemove().entrySet()) {
if (object.getValue().contains(INCLUSION_RULES))
profileChangeRequest.setInstallableUnitProfileProperty(object.getKey(), INCLUSION_RULES, PlannerHelper.createStrictInclusionRule(object.getKey()));
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
index c6f9cc4cc..6427a2f38 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
@@ -44,20 +44,16 @@ public class FormerState {
}
//additions
- for (Iterator<IInstallableUnit> iterator = iusToAdd.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
- for (Iterator<Entry<String, String>> it = target.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (IInstallableUnit iu : iusToAdd) {
+ for (Entry<String, String> entry : target.getInstallableUnitProperties(iu).entrySet()) {
request.setInstallableUnitProfileProperty(iu, entry.getKey(), entry.getValue());
}
}
// updates
- for (Iterator<IInstallableUnit> iterator = iusToUpdate.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : iusToUpdate) {
Map<String, String> propertiesToSet = new HashMap<String, String>(target.getInstallableUnitProperties(iu));
- for (Iterator<Entry<String, String>> it = current.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : current.getInstallableUnitProperties(iu).entrySet()) {
String key = entry.getKey();
String newValue = propertiesToSet.get(key);
if (newValue == null) {
@@ -66,8 +62,7 @@ public class FormerState {
propertiesToSet.remove(key);
}
- for (Iterator<Entry<String, String>> it = propertiesToSet.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : propertiesToSet.entrySet()) {
request.setInstallableUnitProfileProperty(iu, entry.getKey(), entry.getValue());
}
}
@@ -90,8 +85,7 @@ public class FormerState {
private static void synchronizeProfileProperties(ProfileChangeRequest request, IProfile current, IProfile target) {
Map<String, String> profilePropertiesToSet = new HashMap<String, String>(target.getProperties());
- for (Iterator<Entry<String, String>> it = current.getProperties().entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : current.getProperties().entrySet()) {
String key = entry.getKey();
String newValue = profilePropertiesToSet.get(key);
@@ -101,8 +95,7 @@ public class FormerState {
profilePropertiesToSet.remove(key);
}
- for (Iterator<Entry<String, String>> it = profilePropertiesToSet.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : profilePropertiesToSet.entrySet()) {
request.setProfileProperty(entry.getKey(), entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
index 326ac1f51..012305585 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
@@ -53,8 +53,8 @@ public class ProfileChangeRequest implements Cloneable {
public Map<String, String> getProfileProperties() {
Map<String, String> result = new HashMap<String, String>(profile.getProperties());
if (propertiesToRemove != null) {
- for (Iterator<String> it = propertiesToRemove.iterator(); it.hasNext();) {
- result.remove(it.next());
+ for (String key : propertiesToRemove) {
+ result.remove(key);
}
}
if (propertiesToAdd != null)
@@ -70,8 +70,8 @@ public class ProfileChangeRequest implements Cloneable {
}
public void addInstallableUnits(Collection<IInstallableUnit> toInstall) {
- for (Iterator<IInstallableUnit> itor = toInstall.iterator(); itor.hasNext();)
- addInstallableUnit(itor.next());
+ for (IInstallableUnit iu : toInstall)
+ addInstallableUnit(iu);
}
public void addInstallableUnits(IQueryResult<IInstallableUnit> toInstall) {
@@ -96,8 +96,8 @@ public class ProfileChangeRequest implements Cloneable {
}
public void removeInstallableUnits(Collection<IInstallableUnit> toUninstall) {
- for (Iterator<IInstallableUnit> itor = toUninstall.iterator(); itor.hasNext();)
- removeInstallableUnit(itor.next());
+ for (IInstallableUnit iu : toUninstall)
+ removeInstallableUnit(iu);
}
public void removeInstallableUnits(IQueryResult<IInstallableUnit> toUninstall) {
@@ -215,16 +215,16 @@ public class ProfileChangeRequest implements Cloneable {
result.append('\n');
result.append("==Additions=="); //$NON-NLS-1$
result.append('\n');
- for (Iterator<IInstallableUnit> iterator = iusToAdd.iterator(); iterator.hasNext();) {
+ for (IInstallableUnit iu : iusToAdd) {
result.append('\t');
- result.append(iterator.next());
+ result.append(iu);
result.append('\n');
}
result.append("==Removals=="); //$NON-NLS-1$
result.append('\n');
- for (Iterator<IInstallableUnit> iterator = iusToRemove.iterator(); iterator.hasNext();) {
+ for (IInstallableUnit iu : iusToRemove) {
result.append('\t');
- result.append(iterator.next());
+ result.append(iu);
result.append('\n');
}
return result.toString();
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
index f5ee63a7c..8dd8591ad 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
@@ -43,8 +43,8 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
private void saveRemovals() {
- for (Iterator<IArtifactDescriptor> i = descriptorsToRemove.iterator(); i.hasNext();)
- innerRepo.removeDescriptor(i.next());
+ for (IArtifactDescriptor desc : descriptorsToRemove)
+ innerRepo.removeDescriptor(desc);
descriptorsToRemove.clear();
}
@@ -57,8 +57,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
private void savePropertyChanges() {
- for (Iterator<String> i = propertyChanges.keySet().iterator(); i.hasNext();) {
- String key = i.next();
+ for (String key : propertyChanges.keySet()) {
String value = propertyChanges.get(key);
innerRepo.setProperty(key, value == NULL ? null : value);
}
@@ -247,9 +246,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
};
- @SuppressWarnings("unchecked")
- CompoundQueryable<IArtifactDescriptor> compound = new CompoundQueryable<IArtifactDescriptor>(new IQueryable[] {cached, innerRepo.descriptorQueryable()});
- return compound;
+ return new CompoundQueryable<IArtifactDescriptor>(cached, innerRepo.descriptorQueryable());
}
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
@@ -260,8 +257,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
};
- @SuppressWarnings("unchecked")
- CompoundQueryable<IArtifactKey> compound = new CompoundQueryable<IArtifactKey>(new IQueryable[] {cached, innerRepo});
+ CompoundQueryable<IArtifactKey> compound = new CompoundQueryable<IArtifactKey>(cached, innerRepo);
return compound.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
index 11ed47fd6..c47d07603 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
@@ -133,8 +133,8 @@ public class DirectoryWatcher {
removals = scannedFiles;
scannedFiles = new HashSet<File>();
pendingDeletions = new HashSet<File>();
- for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();)
- i.next().startPoll();
+ for (DirectoryChangeListener listener : listeners)
+ listener.startPoll();
}
private void scanDirectories() {
@@ -155,8 +155,7 @@ public class DirectoryWatcher {
// removed at the end. Then notify all the listeners as needed.
scannedFiles.add(file);
removals.remove(file);
- for (Iterator<DirectoryChangeListener> iterator = listeners.iterator(); iterator.hasNext();) {
- DirectoryChangeListener listener = iterator.next();
+ for (DirectoryChangeListener listener : listeners) {
if (isInterested(listener, file))
processFile(file, listener);
}
@@ -168,8 +167,8 @@ public class DirectoryWatcher {
private void stopPoll() {
notifyRemovals();
removals = scannedFiles;
- for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();)
- i.next().stopPoll();
+ for (DirectoryChangeListener listener : listeners)
+ listener.stopPoll();
processPendingDeletions();
}
@@ -182,10 +181,8 @@ public class DirectoryWatcher {
*/
private void notifyRemovals() {
Set<File> removed = removals;
- for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();) {
- DirectoryChangeListener listener = i.next();
- for (Iterator<File> j = removed.iterator(); j.hasNext();) {
- File file = j.next();
+ for (DirectoryChangeListener listener : listeners) {
+ for (File file : removed) {
if (isInterested(listener, file))
listener.removed(file);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
index ddecadf63..b43a1d99f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
@@ -115,8 +115,7 @@ public class DownloadManager {
private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository) {
ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>();
- for (Iterator<IArtifactRequest> it = requestsToProcess.iterator(); it.hasNext();) {
- IArtifactRequest request = it.next();
+ for (IArtifactRequest request : requestsToProcess) {
if (repository.contains(request.getArtifactKey()))
applicable.add(request);
}
@@ -136,8 +135,8 @@ public class DownloadManager {
return Status.OK_STATUS;
MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator<IArtifactRequest> iterator = requestsToProcess.iterator(); iterator.hasNext();) {
- IStatus failed = iterator.next().getResult();
+ for (IArtifactRequest request : requestsToProcess) {
+ IStatus failed = request.getResult();
if (failed != null && !failed.isOK())
result.add(failed);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
index aad0d1d27..e9f6b1919 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
@@ -93,8 +93,7 @@ public class EngineSession {
IStatus prepare(IProgressMonitor monitor) {
monitor.subTask(Messages.preparing);
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = iterator.next();
+ for (Touchpoint touchpoint : touchpoints) {
try {
status.add(touchpoint.prepare(profile));
} catch (RuntimeException e) {
@@ -119,8 +118,7 @@ public class EngineSession {
monitor.subTask(Messages.committing);
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
phaseActionRecordsPairs.clear();
- for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = iterator.next();
+ for (Touchpoint touchpoint : touchpoints) {
try {
IStatus result = touchpoint.commit(profile);
if (!result.isOK())
@@ -191,8 +189,7 @@ public class EngineSession {
}
phaseActionRecordsPairs.clear();
- for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = iterator.next();
+ for (Touchpoint touchpoint : touchpoints) {
try {
IStatus result = touchpoint.rollback(profile);
if (!result.isOK())
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
index ce4ff7d44..0b73128fa 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
@@ -42,8 +42,7 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
private Map<String, Object> processActionParameters(Map<String, Object> parameters) {
Map<String, Object> result = new HashMap<String, Object>(parameters);
- for (Iterator<Entry<String, String>> it = actionParameters.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : actionParameters.entrySet()) {
String name = entry.getKey();
String value = processVariables(entry.getValue(), parameters);
result.put(name, value);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
index ca6f56587..88b3cb0d5 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
@@ -282,8 +282,7 @@ public abstract class Phase {
return Status.OK_STATUS;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator<Entry<Touchpoint, Map<String, Object>>> it = touchpointToTouchpointPhaseParameters.entrySet().iterator(); it.hasNext();) {
- Entry<Touchpoint, Map<String, Object>> entry = it.next();
+ for (Entry<Touchpoint, Map<String, Object>> entry : touchpointToTouchpointPhaseParameters.entrySet()) {
Touchpoint touchpoint = entry.getKey();
Map<String, Object> touchpointParameters = entry.getValue();
mergeStatus(status, touchpoint.completePhase(monitor, profile, phaseId, touchpointParameters));
@@ -301,8 +300,7 @@ public abstract class Phase {
return Status.OK_STATUS;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator<Entry<Touchpoint, Map<String, Object>>> it = touchpointToTouchpointOperandParameters.entrySet().iterator(); it.hasNext();) {
- Entry<Touchpoint, Map<String, Object>> entry = it.next();
+ for (Entry<Touchpoint, Map<String, Object>> entry : touchpointToTouchpointOperandParameters.entrySet()) {
Touchpoint touchpoint = entry.getKey();
Map<String, Object> touchpointParameters = entry.getValue();
mergeStatus(status, touchpoint.completeOperand(profile, operand, touchpointParameters));
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
index 60486f67e..e4a8e587f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
@@ -314,14 +314,12 @@ public class Profile implements IProfile {
snapshot.setTimestamp(timestamp);
if (subProfileIds != null) {
- for (Iterator<String> it = subProfileIds.iterator(); it.hasNext();) {
- String subProfileId = it.next();
+ for (String subProfileId : subProfileIds) {
snapshot.addSubProfile(subProfileId);
}
}
- for (Iterator<IInstallableUnit> it = ius.iterator(); it.hasNext();) {
- IInstallableUnit iu = it.next();
+ for (IInstallableUnit iu : ius) {
snapshot.addInstallableUnit(iu);
Map<String, String> properties = getInstallableUnitProperties(iu);
if (properties != null)
@@ -332,8 +330,7 @@ public class Profile implements IProfile {
}
public void addInstallableUnitProperties(IInstallableUnit iu, Map<String, String> properties) {
- for (Iterator<Entry<String, String>> it = properties.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : properties.entrySet()) {
setInstallableUnitProperty(iu, entry.getKey(), entry.getValue());
}
}
@@ -347,14 +344,13 @@ public class Profile implements IProfile {
Set<IInstallableUnit> keys = iuProperties.keySet();
// Set orphans = new HashSet();
Collection<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
- for (Iterator<IInstallableUnit> iterator = keys.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : keys) {
if (!ius.contains(iu))
toRemove.add(iu);
}
- for (Iterator<IInstallableUnit> iterator = toRemove.iterator(); iterator.hasNext();) {
- iuProperties.remove(iterator.next());
+ for (IInstallableUnit iu : toRemove) {
+ iuProperties.remove(iu);
}
// List iuKeys = new ArrayList();
// for (Iterator it = ius.iterator(); it.hasNext();)
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
index c9481ef6b..36df87fd5 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
@@ -56,8 +56,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), IProvisioningEventBus.SERVICE_NAME);
if (bus == null)
return;
- for (Iterator<URI> it = artifactRepos.iterator(); it.hasNext();) {
- URI repo = it.next();
+ for (URI repo : artifactRepos) {
bus.publishEvent(new RepositoryEvent(repo, IRepository.TYPE_ARTIFACT, RepositoryEvent.DISCOVERED, true));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index d2edb719a..6c8855558 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -251,9 +251,8 @@ public class SimpleProfileRegistry implements IProfileRegistry {
Map<String, Profile> profileMap = getProfileMap();
Profile[] result = new Profile[profileMap.size()];
int i = 0;
- for (Iterator<Profile> it = profileMap.values().iterator(); it.hasNext(); i++) {
- Profile profile = it.next();
- result[i] = profile.snapshot();
+ for (Profile profile : profileMap.values()) {
+ result[i++] = profile.snapshot();
}
return result;
}
@@ -633,8 +632,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
public Map<String, Profile> getProfileMap() {
Map<String, Profile> profileMap = new HashMap<String, Profile>();
- for (Iterator<String> it = profileHandlers.keySet().iterator(); it.hasNext();) {
- String profileId = it.next();
+ for (String profileId : profileHandlers.keySet()) {
addProfile(profileId, profileMap);
}
return profileMap;
@@ -666,8 +664,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
profile.addInstallableUnit(iu);
Map<String, String> iuProperties = profileHandler.getIUProperties(iu);
if (iuProperties != null) {
- for (Iterator<Entry<String, String>> it = iuProperties.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ for (Entry<String, String> entry : iuProperties.entrySet()) {
profile.setInstallableUnitProperty(iu, entry.getKey(), entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
index 8e3ed8f8a..42f04bcbf 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
@@ -15,7 +15,6 @@ import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.cert.Certificate;
import java.util.ArrayList;
-import java.util.Iterator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
@@ -66,8 +65,7 @@ public class CertificateChecker {
IStatus status = Status.OK_STATUS;
if (artifacts.size() == 0 || serviceUI == null)
return status;
- for (Iterator<File> it = artifacts.iterator(); it.hasNext();) {
- File artifact = it.next();
+ for (File artifact : artifacts) {
try {
content = verifierFactory.getSignedContent(artifact);
if (!content.isSigned()) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
index cd40190b1..430c5f4c7 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
@@ -72,8 +72,7 @@ public class Collect extends InstallableUnitPhase {
IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
DownloadManager dm = new DownloadManager(context, repositoryManager);
- for (Iterator<IArtifactRequest[]> it = artifactRequests.iterator(); it.hasNext();) {
- IArtifactRequest[] requests = it.next();
+ for (IArtifactRequest[] requests : artifactRequests) {
dm.add(requests);
}
return dm.start(monitor);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
index 2bc577137..ac3d58cce 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
@@ -77,8 +77,7 @@ public class Sizing extends InstallableUnitPhase {
Set<IArtifactRequest> artifactsToObtain = new HashSet<IArtifactRequest>(artifactRequests.size());
- for (Iterator<IArtifactRequest[]> it = artifactRequests.iterator(); it.hasNext();) {
- IArtifactRequest[] requests = it.next();
+ for (IArtifactRequest[] requests : artifactRequests) {
if (requests == null)
continue;
for (int i = 0; i < requests.length; i++) {
@@ -96,8 +95,9 @@ public class Sizing extends InstallableUnitPhase {
else
repositories = context.getArtifactRepositories();
- for (Iterator<IArtifactRequest> iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) {
- IArtifactRequest artifactRequest = iterator.next();
+ for (IArtifactRequest artifactRequest : artifactsToObtain) {
+ if (monitor.isCanceled())
+ break;
boolean found = false;
for (int i = 0; i < repositories.length; i++) {
IArtifactRepository repo;
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
index 9bf52088c..f6996cbf9 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
@@ -251,8 +251,7 @@ public class SiteListener extends DirectoryChangeListener {
}
Map<String, File> pluginCache = getPlugins(siteFile);
Map<File, Feature> featureCache = getFeatures(siteFile);
- for (Iterator<File> iter = featureCache.keySet().iterator(); iter.hasNext();) {
- File featureFile = iter.next();
+ for (File featureFile : featureCache.keySet()) {
// add the feature path
result.add(featureFile.toString());
Feature feature = featureCache.get(featureFile);
diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java
index 99daefb2b..70b602ca7 100644
--- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java
+++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java
@@ -77,9 +77,7 @@ public class GarbageCollector {
}
private void invokeCoreGC() {
- Iterator<IArtifactRepository> keyIterator = markSet.keySet().iterator();
- while (keyIterator.hasNext()) {
- IArtifactRepository nextRepo = keyIterator.next();
+ for (IArtifactRepository nextRepo : markSet.keySet()) {
IArtifactKey[] keys = markSet.get(nextRepo).toArray(new IArtifactKey[0]);
MarkSet aMarkSet = new MarkSet(keys, nextRepo);
new CoreGarbageCollector().clean(aMarkSet.getKeys(), aMarkSet.getRepo());
diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
index 7a1c1d10a..6aa85337d 100644
--- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
+++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java
@@ -235,10 +235,8 @@ public class InstallUpdateProductOperation implements IInstallOperation {
}
private void postInstall() {
- for (Iterator<ServiceReference> it = serviceReferences.iterator(); it.hasNext();) {
- ServiceReference sr = it.next();
+ for (ServiceReference sr : serviceReferences)
bundleContext.ungetService(sr);
- }
serviceReferences.clear();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
index 6e69be2fe..907d4e4c9 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
@@ -216,8 +216,7 @@ public class CacheManager {
* @param repositoryLocation
*/
void deleteCache(URI repositoryLocation) {
- for (Iterator<String> it = knownPrefixes.iterator(); it.hasNext();) {
- String prefix = it.next();
+ for (String prefix : knownPrefixes) {
File[] cacheFiles = getCacheFiles(repositoryLocation, prefix);
for (int i = 0; i < cacheFiles.length; i++) {
// delete the cache file if it exists
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
index f5e8cb2cd..015332fc5 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
@@ -23,7 +23,6 @@ import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.CompoundQueryable;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.AbstractMetadataRepository;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -131,7 +130,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
monitor = new NullProgressMonitor();
try {
// Query all the all the repositories this composite repo contains
- CompoundQueryable<IInstallableUnit> queryable = new CompoundQueryable<IInstallableUnit>(loadedRepos.toArray(new IQueryable[loadedRepos.size()]));
+ CompoundQueryable<IInstallableUnit> queryable = new CompoundQueryable<IInstallableUnit>(loadedRepos);
return queryable.query(query, monitor);
} finally {
if (monitor != null)
@@ -179,13 +178,12 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
if (removed) {
// we removed the child from the list so remove the associated repo object as well
IMetadataRepository found = null;
- for (Iterator<IMetadataRepository> iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
- IMetadataRepository current = iter.next();
+ for (IMetadataRepository current : loadedRepos) {
URI repoLocation = current.getLocation();
- if (URIUtil.sameURI(childURI, repoLocation))
- found = current;
- else if (URIUtil.sameURI(other, repoLocation))
+ if (URIUtil.sameURI(childURI, repoLocation) || URIUtil.sameURI(other, repoLocation)) {
found = current;
+ break;
+ }
}
if (found != null)
loadedRepos.remove(found);
@@ -276,8 +274,8 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
public List<URI> getChildren() {
List<URI> result = new ArrayList<URI>();
- for (Iterator<URI> iter = childrenURIs.iterator(); iter.hasNext();)
- result.add(URIUtil.makeAbsolute(iter.next(), location));
+ for (URI childURI : childrenURIs)
+ result.add(URIUtil.makeAbsolute(childURI, location));
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
index e14805c42..b0c9779c3 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
@@ -101,7 +101,7 @@ public class IUMap {
}
public void removeAll(Collection<IInstallableUnit> toRemove) {
- for (Iterator<IInstallableUnit> it = toRemove.iterator(); it.hasNext();)
- remove(it.next());
+ for (IInstallableUnit iu : toRemove)
+ remove(iu);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
index 8acc3883c..5f7555c06 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
@@ -121,8 +121,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
return;
List<RepositoryReference> repositoriesSnapshot = createRepositoriesSnapshot();
- for (Iterator<RepositoryReference> it = repositoriesSnapshot.iterator(); it.hasNext();) {
- RepositoryReference reference = it.next();
+ for (RepositoryReference reference : repositoriesSnapshot) {
boolean isEnabled = (reference.Options & IRepository.ENABLED) != 0;
bus.publishEvent(new RepositoryEvent(reference.Location, reference.Type, RepositoryEvent.DISCOVERED, isEnabled));
}
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 1a4af5db9..65e8de9d9 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
@@ -14,6 +14,7 @@ package org.eclipse.equinox.internal.p2.metadata.repository.io;
import java.net.URI;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
@@ -98,10 +99,8 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
int size = units.size();
IInstallableUnit[] result = new IInstallableUnit[size];
int i = 0;
- for (Iterator<InstallableUnitDescription> it = units.iterator(); it.hasNext(); i++) {
- InstallableUnitDescription desc = it.next();
- result[i] = MetadataFactory.createInstallableUnit(desc);
- }
+ for (InstallableUnitDescription desc : units)
+ result[i++] = MetadataFactory.createInstallableUnit(desc);
return result;
}
@@ -275,9 +274,9 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
OrderedProperties properties = (propertiesHandler == null ? new OrderedProperties(0) : propertiesHandler.getProperties());
String updateFrom = null;
VersionRange updateRange = null;
- for (Enumeration<String> e = properties.keys(); e.hasMoreElements();) {
- String key = e.nextElement();
- String value = properties.getProperty(key);
+ for (Entry<String, String> e : properties.entrySet()) {
+ String key = e.getKey();
+ String value = e.getValue();
//Backward compatibility
if (key.equals("equinox.p2.update.from")) { //$NON-NLS-1$
updateFrom = value;
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 c6c184f2e..a75ad83e2 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
@@ -239,8 +239,7 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
if (instructions.size() > 0) {
start(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, instructions.size());
- for (Iterator<Entry<String, ITouchpointInstruction>> iter = instructions.entrySet().iterator(); iter.hasNext();) {
- Entry<String, ITouchpointInstruction> entry = iter.next();
+ for (Entry<String, ITouchpointInstruction> entry : instructions.entrySet()) {
start(TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
attribute(TOUCHPOINT_DATA_INSTRUCTION_KEY_ATTRIBUTE, entry.getKey());
ITouchpointInstruction instruction = entry.getValue();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
index 1ba1abb20..6c3ed7ce6 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
@@ -82,8 +82,7 @@ public class TouchpointData implements ITouchpointData {
*/
public String toString() {
StringBuffer result = new StringBuffer();
- for (Iterator<Entry<String, ITouchpointInstruction>> iterator = instructions.entrySet().iterator(); iterator.hasNext();) {
- Entry<String, ITouchpointInstruction> instruction = iterator.next();
+ for (Entry<String, ITouchpointInstruction> instruction : instructions.entrySet()) {
result.append(instruction.getKey()).append(" -> ").append(instruction.getValue()).append('\n'); //$NON-NLS-1$
}
return result.toString();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
index 1a7879389..25da13ab3 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata;
-import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointInstruction;
@@ -69,13 +68,15 @@ public class TouchpointInstruction implements ITouchpointInstruction {
public static String encodeAction(String actionName, Map<String, String> parameters) {
StringBuffer result = new StringBuffer(actionName);
result.append('(');
- for (Iterator<Entry<String, String>> it = parameters.entrySet().iterator(); it.hasNext();) {
- Entry<String, String> entry = it.next();
+ boolean first = true;
+ for (Entry<String, String> entry : parameters.entrySet()) {
+ if (first)
+ first = false;
+ else
+ result.append(',');
result.append(entry.getKey());
result.append(':');
appendEncoded(result, entry.getValue());
- if (it.hasNext())
- result.append(',');
}
result.append(')').append(';');
return result.toString();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
index 640931296..bbbd2f170 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
@@ -257,8 +257,7 @@ public class TranslationSupport {
}
}
- for (Iterator<String> iter = locales.iterator(); iter.hasNext();) {
- String nextLocale = iter.next();
+ for (String nextLocale : locales) {
String localeKey = makeLocalizedKey(actualKey, nextLocale);
String nextValue = iu.getProperty(localeKey);
if (nextValue != null)
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
index 8d2a6f3fc..3e3907a97 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
@@ -405,8 +405,7 @@ public class MetadataFactory {
return initial;
Map<String, ITouchpointInstruction> resultInstructions = new HashMap<String, ITouchpointInstruction>(initial.getInstructions());
- for (Iterator<String> iterator = incomingInstructions.keySet().iterator(); iterator.hasNext();) {
- String key = iterator.next();
+ for (String key : incomingInstructions.keySet()) {
ITouchpointInstruction instruction = incomingInstructions.get(key);
ITouchpointInstruction existingInstruction = resultInstructions.get(key);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
index dc6c12a4d..1952f2403 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
@@ -24,10 +24,30 @@ public class CompoundQueryable<T> implements IQueryable<T> {
private IQueryable<T>[] queryables;
- public CompoundQueryable(IQueryable<T>[] queryables) {
+ private CompoundQueryable(IQueryable<T>[] queryables) {
this.queryables = queryables;
}
+ @SuppressWarnings("unchecked")
+ public CompoundQueryable(Collection<? extends IQueryable<T>> queryables) {
+ this(queryables.toArray(new IQueryable[queryables.size()]));
+ }
+
+ @SuppressWarnings("unchecked")
+ public CompoundQueryable(IQueryable<T> q) {
+ this(new IQueryable[] {q});
+ }
+
+ @SuppressWarnings("unchecked")
+ public CompoundQueryable(IQueryable<T> q1, IQueryable<T> q2) {
+ this(new IQueryable[] {q1, q2});
+ }
+
+ @SuppressWarnings("unchecked")
+ public CompoundQueryable(IQueryable<T> q1, IQueryable<T> q2, IQueryable<T> q3) {
+ this(new IQueryable[] {q1, q2, q3});
+ }
+
public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
IQueryResult<T> subResults = null;
if (monitor == null) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
index a36103210..e10b6c502 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
@@ -11,10 +11,9 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.publisher.eclipse;
-import java.io.File;
-
import java.io.*;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
@@ -225,8 +224,8 @@ public class ExecutablesDescriptor {
try {
tempFile = File.createTempFile("p2.brandingIron", ""); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.delete();
- for (Iterator<File> i = files.iterator(); i.hasNext();)
- FileUtils.copy(location, tempFile, i.next(), true);
+ for (File file : files)
+ FileUtils.copy(location, tempFile, file, true);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error publishing artifacts", e)); //$NON-NLS-1$
}
@@ -248,8 +247,7 @@ public class ExecutablesDescriptor {
String executableExtension = Constants.OS_WIN32.equals(os) ? ".exe" : ""; //$NON-NLS-1$ //$NON-NLS-2$
targetExecutable = executableName + executableExtension;
Set<File> filesCopy = new HashSet<File>(files);
- for (Iterator<File> i = filesCopy.iterator(); i.hasNext();) {
- File file = i.next();
+ for (File file : filesCopy) {
String base = file.getParent();
// use String concatenation here because new File("", "foo") is absolute on at least windows...
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
index aea9a7a35..14953a67e 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
@@ -161,8 +161,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
*/
protected Collection<IRequirement> createIURequirements(Collection<? extends IVersionedId> children) {
ArrayList<IRequirement> result = new ArrayList<IRequirement>(children.size());
- for (Iterator<? extends IVersionedId> i = children.iterator(); i.hasNext();) {
- IVersionedId next = i.next();
+ for (IVersionedId next : children) {
if (next instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) next;
VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true);
@@ -181,8 +180,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
if (info == null)
return null;
Collection<IFilterAdvice> filterAdvice = info.getAdvice(CONFIG_ANY, true, name.getId(), name.getVersion(), IFilterAdvice.class);
- for (Iterator<IFilterAdvice> i = filterAdvice.iterator(); i.hasNext();) {
- IFilterAdvice advice = i.next();
+ for (IFilterAdvice advice : filterAdvice) {
String result = advice.getFilter(name.getId(), name.getVersion(), false);
if (result != null)
return result;
@@ -238,8 +236,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
return null;
List<InstallableUnitDescription> ius = new ArrayList<InstallableUnitDescription>();
- for (Iterator<IAdditionalInstallableUnitAdvice> iterator = advice.iterator(); iterator.hasNext();) {
- IAdditionalInstallableUnitAdvice entry = iterator.next();
+ for (IAdditionalInstallableUnitAdvice entry : advice) {
InstallableUnitDescription[] others = entry.getAdditionalInstallableUnitDescriptions(iu);
if (others != null)
ius.addAll(Arrays.asList(others));
@@ -258,13 +255,11 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
return;
Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
- for (Iterator<IPropertyAdvice> i = advice.iterator(); i.hasNext();) {
- IPropertyAdvice entry = i.next();
+ for (IPropertyAdvice entry : advice) {
Map<String, String> props = entry.getArtifactProperties(iu, descriptor);
if (props == null)
continue;
- for (Iterator<Entry<String, String>> j = props.entrySet().iterator(); j.hasNext();) {
- Entry<String, String> pe = j.next();
+ for (Entry<String, String> pe : props.entrySet()) {
((SimpleArtifactDescriptor) descriptor).setRepositoryProperty(pe.getKey(), pe.getValue());
}
}
@@ -277,13 +272,11 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
*/
protected static void processInstallableUnitPropertiesAdvice(InstallableUnitDescription iu, IPublisherInfo info) {
Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
- for (Iterator<IPropertyAdvice> i = advice.iterator(); i.hasNext();) {
- IPropertyAdvice entry = i.next();
+ for (IPropertyAdvice entry : advice) {
Map<String, String> props = entry.getInstallableUnitProperties(iu);
if (props == null)
continue;
- for (Iterator<Entry<String, String>> j = props.entrySet().iterator(); j.hasNext();) {
- Entry<String, String> pe = j.next();
+ for (Entry<String, String> pe : props.entrySet()) {
iu.setProperty(pe.getKey(), pe.getValue());
}
}
@@ -299,8 +292,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
if (advice.isEmpty())
return;
- for (Iterator<ICapabilityAdvice> i = advice.iterator(); i.hasNext();) {
- ICapabilityAdvice entry = i.next();
+ for (ICapabilityAdvice entry : advice) {
//process required capabilities
IRequirement[] requiredAdvice = entry.getRequiredCapabilities(iu);
@@ -406,8 +398,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions);
if (advice != null) {
- for (Iterator<ITouchpointAdvice> i = advice.iterator(); i.hasNext();) {
- ITouchpointAdvice entry = i.next();
+ for (ITouchpointAdvice entry : advice) {
result = entry.getTouchpointData(result);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
index 10a8c6689..806dde4a0 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
@@ -36,8 +36,7 @@ public class PublisherInfo implements IPublisherInfo {
@SuppressWarnings("unchecked")
public <T extends IPublisherAdvice> Collection<T> getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class<T> type) {
ArrayList<T> result = new ArrayList<T>();
- for (Iterator<IPublisherAdvice> i = adviceList.iterator(); i.hasNext();) {
- IPublisherAdvice advice = i.next();
+ for (IPublisherAdvice advice : adviceList) {
if (type.isInstance(advice) && advice.isApplicable(configSpec, includeDefault, id, version))
// Ideally, we would use Class.cast here but it was introduced in Java 1.5
result.add((T) advice);
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
index 4bcf2521a..7be062646 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
@@ -33,8 +33,8 @@ public class PublisherResult implements IPublisherResult {
}
public void addIUs(Collection<IInstallableUnit> ius, String type) {
- for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();)
- addIU(i.next(), type);
+ for (IInstallableUnit iu : ius)
+ addIU(iu, type);
}
private void addIU(Map<String, Set<IInstallableUnit>> map, String id, IInstallableUnit iu) {
@@ -49,16 +49,14 @@ public class PublisherResult implements IPublisherResult {
public IInstallableUnit getIU(String id, Version version, String type) {
if (type == null || type == ROOT) {
Collection<IInstallableUnit> ius = rootIUs.get(id);
- for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = i.next();
+ for (IInstallableUnit iu : ius) {
if (iu.getVersion().equals(version))
return iu;
}
}
if (type == null || type == NON_ROOT) {
Collection<IInstallableUnit> ius = nonRootIUs.get(id);
- for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = i.next();
+ for (IInstallableUnit iu : ius) {
if (iu.getVersion().equals(version))
return iu;
}
@@ -106,9 +104,9 @@ public class PublisherResult implements IPublisherResult {
protected List<IInstallableUnit> flatten(Collection<Set<IInstallableUnit>> values) {
ArrayList<IInstallableUnit> result = new ArrayList<IInstallableUnit>();
- for (Iterator<Set<IInstallableUnit>> i = values.iterator(); i.hasNext();)
- for (Iterator<IInstallableUnit> j = i.next().iterator(); j.hasNext();)
- result.add(j.next());
+ for (Set<IInstallableUnit> iuSet : values)
+ for (IInstallableUnit iu : iuSet)
+ result.add(iu);
return result;
}
@@ -146,17 +144,14 @@ public class PublisherResult implements IPublisherResult {
return queryIU((InstallableUnitQuery) query, monitor);
IQueryable<IInstallableUnit> nonRootQueryable = new QueryableMap(nonRootIUs);
IQueryable<IInstallableUnit> rootQueryable = new QueryableMap(rootIUs);
- @SuppressWarnings("unchecked")
- IQueryable<IInstallableUnit>[] queryables = new IQueryable[] {nonRootQueryable, rootQueryable};
- return new CompoundQueryable<IInstallableUnit>(queryables).query(query, monitor);
+ return new CompoundQueryable<IInstallableUnit>(nonRootQueryable, rootQueryable).query(query, monitor);
}
private IQueryResult<IInstallableUnit> queryIU(InstallableUnitQuery query, IProgressMonitor monitor) {
Collector<IInstallableUnit> result = new Collector<IInstallableUnit>();
Collection<IInstallableUnit> matches = getIUs(query.getId(), null);
VersionRange queryRange = query.getRange();
- for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();) {
- IInstallableUnit match = it.next();
+ for (IInstallableUnit match : matches) {
if (queryRange == null || queryRange.isIncluded(match.getVersion()))
if (!result.accept(match))
break;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
index 02becbfb1..b7594e04c 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
@@ -145,8 +145,7 @@ public class RootFilesAction extends AbstractPublisherAction {
ArrayList<File> inclusions = new ArrayList<File>();
ArrayList<File> exclusions = new ArrayList<File>();
File root = null;
- for (Iterator<IRootFilesAdvice> i = advice.iterator(); i.hasNext();) {
- IRootFilesAdvice entry = i.next();
+ for (IRootFilesAdvice entry : advice) {
// TODO for now we simply get root from the first advice that has one
if (root == null)
root = entry.getRoot();
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
index 837def9b8..f1f6f1898 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
@@ -12,7 +12,8 @@ package org.eclipse.equinox.p2.publisher.actions;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashSet;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.p2.publisher.Messages;
@@ -124,12 +125,10 @@ public class RootIUAction extends AbstractPublisherAction {
Collection<IRootIUAdvice> rootAdvice = info.getAdvice(null, true, null, null, IRootIUAdvice.class);
if (rootAdvice == null)
return children;
- for (Iterator<IRootIUAdvice> i = rootAdvice.iterator(); i.hasNext();) {
- IRootIUAdvice advice = i.next();
+ for (IRootIUAdvice advice : rootAdvice) {
Collection<? extends Object> list = advice.getChildren(result);
if (list != null)
- for (Iterator<? extends Object> j = list.iterator(); j.hasNext();) {
- Object object = j.next();
+ for (Object object : list) {
// if the advice is a string, look it up in the result. if not there then
// query the known metadata repos
if (object instanceof String) {
@@ -173,8 +172,7 @@ public class RootIUAction extends AbstractPublisherAction {
if (versionAdvice == null)
return null;
}
- for (Iterator<IVersionAdvice> i = versionAdvice.iterator(); i.hasNext();) {
- IVersionAdvice advice = i.next();
+ for (IVersionAdvice advice : versionAdvice) {
// TODO have to figure a way to know the namespace here. for now just look everywhere
Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID);
if (result == null)
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
index bedcbd3eb..acccb383d 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
@@ -54,8 +54,7 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
//nothing
}
}
- for (Iterator<Entry<String, String>> itor = properties.entrySet().iterator(); itor.hasNext();) {
- Entry<String, String> entry = itor.next();
+ for (Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
if (idSuffix != null)
key += idSuffix;
@@ -109,8 +108,7 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
if (!(advice instanceof VersionAdvice))
return this;
VersionAdvice source = (VersionAdvice) advice;
- for (Iterator<String> i = source.versions.keySet().iterator(); i.hasNext();) {
- String namespace = i.next();
+ for (String namespace : source.versions.keySet()) {
Map<String, Version> myValues = versions.get(namespace);
Map<String, Version> sourceValues = source.versions.get(namespace);
if (myValues == null)
@@ -123,8 +121,7 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
private Map<String, Version> merge(Map<String, Version> myValues, Map<String, Version> sourceValues) {
Map<String, Version> result = new HashMap<String, Version>(myValues);
- for (Iterator<String> i = sourceValues.keySet().iterator(); i.hasNext();) {
- String key = i.next();
+ for (String key : sourceValues.keySet()) {
if (result.get(key) == null)
result.put(key, sourceValues.get(key));
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
index ad6a65236..20c5ab50f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
@@ -386,8 +386,7 @@ public class AdviceFileParser {
((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
if (!unitProperties.isEmpty()) {
- for (Iterator<Entry<String, String>> iterator = unitProperties.entrySet().iterator(); iterator.hasNext();) {
- Entry<String, String> entry = iterator.next();
+ for (Entry<String, String> entry : unitProperties.entrySet()) {
description.setProperty(entry.getKey(), entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
index 12d41a045..dbebda745 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
@@ -62,10 +62,10 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
createAdvice(publisherInfo, results);
IPublisherResult innerResult = new PublisherResult();
MultiStatus finalStatus = new MultiStatus(ApplicationLauncherAction.class.getName(), 0, "publishing result", null); //$NON-NLS-1$
- for (Iterator<IPublisherAction> i = actions.iterator(); i.hasNext();) {
+ for (IPublisherAction action : actions) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
- finalStatus.merge(i.next().perform(publisherInfo, innerResult, monitor));
+ finalStatus.merge(action.perform(publisherInfo, innerResult, monitor));
}
if (!finalStatus.isOK())
return finalStatus;
@@ -90,8 +90,7 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
Collection<IInstallableUnit> ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER);
VersionAdvice advice = new VersionAdvice();
boolean found = false;
- for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = i.next();
+ for (IInstallableUnit iu : ius) {
// skip over source bundles and fragments
// TODO should we use the source property here rather than magic name matching?
if (iu.getId().endsWith(".source") || FragmentQuery.isFragment(iu)) //$NON-NLS-1$
@@ -105,8 +104,7 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
private Collection<IInstallableUnit> getIUs(Collection<IInstallableUnit> ius, String prefix) {
Set<IInstallableUnit> result = new HashSet<IInstallableUnit>();
- for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) {
- IInstallableUnit tmp = iterator.next();
+ for (IInstallableUnit tmp : ius) {
if (tmp.getId().startsWith(prefix))
result.add(tmp);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
index 4fb71ed66..eca9f20f6 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
@@ -196,12 +196,10 @@ public class BundlesAction extends AbstractPublisherAction {
providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_FRAGMENT, bd.getHost().getName(), Version.fromOSGiVersion(bd.getVersion())));
if (manifestLocalizations != null) {
- for (Iterator<Entry<Locale, Map<String, String>>> iter = manifestLocalizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> locEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> locEntry : manifestLocalizations.entrySet()) {
Locale locale = locEntry.getKey();
Map<String, String> translatedStrings = locEntry.getValue();
- for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
- Entry<String, String> entry = transIter.next();
+ for (Entry<String, String> entry : translatedStrings.entrySet()) {
iu.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(bd.getSymbolicName(), locale));
@@ -279,12 +277,10 @@ public class BundlesAction extends AbstractPublisherAction {
// Create a provided capability for each locale and add the translated properties.
ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(hostLocalizations.keySet().size());
- for (Iterator<Entry<Locale, Map<String, String>>> iter = hostLocalizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> localeEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> localeEntry : hostLocalizations.entrySet()) {
Locale locale = localeEntry.getKey();
Map<String, String> translatedStrings = localeEntry.getValue();
- for (Iterator<Entry<String, String>> transItor = translatedStrings.entrySet().iterator(); transItor.hasNext();) {
- Entry<String, String> entry = transItor.next();
+ for (Entry<String, String> entry : translatedStrings.entrySet()) {
fragment.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(hostId, locale));
@@ -382,8 +378,7 @@ public class BundlesAction extends AbstractPublisherAction {
if (p == null)
return null;
StringBuffer result = new StringBuffer();
- for (Iterator<Entry<String, String>> iterator = p.entrySet().iterator(); iterator.hasNext();) {
- Entry<String, String> aProperty = iterator.next();
+ for (Entry<String, String> aProperty : p.entrySet()) {
if (aProperty.getKey().equals(BUNDLE_SHAPE))
continue;
result.append(aProperty.getKey()).append(": ").append(aProperty.getValue()).append('\n'); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
index 2dda6257d..9fb5d1aae 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
@@ -124,8 +124,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
// fill in the missing data.
private BundleInfo[] fillInBundles(Collection<IConfigAdvice> configAdvice, IPublisherResult results) {
ArrayList<BundleInfo> result = new ArrayList<BundleInfo>();
- for (Iterator<IConfigAdvice> j = configAdvice.iterator(); j.hasNext();) {
- IConfigAdvice advice = j.next();
+ for (IConfigAdvice advice : configAdvice) {
int defaultStart = BundleInfo.NO_LEVEL;
Map<String, String> adviceProperties = advice.getProperties();
@@ -245,10 +244,8 @@ public class ConfigCUsAction extends AbstractPublisherAction {
String configurationData = ""; //$NON-NLS-1$
String unconfigurationData = ""; //$NON-NLS-1$
Set<String> properties = new HashSet<String>();
- for (Iterator<IConfigAdvice> i = configAdvice.iterator(); i.hasNext();) {
- IConfigAdvice advice = i.next();
- for (Iterator<Entry<String, String>> iterator = advice.getProperties().entrySet().iterator(); iterator.hasNext();) {
- Entry<String, String> aProperty = iterator.next();
+ for (IConfigAdvice advice : configAdvice) {
+ for (Entry<String, String> aProperty : advice.getProperties().entrySet()) {
String key = aProperty.getKey();
if (shouldPublishProperty(key) && !properties.contains(key)) {
properties.add(key);
@@ -278,8 +275,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
Set<String> jvmSet = new HashSet<String>();
Set<String> programSet = new HashSet<String>();
- for (Iterator<IExecutableAdvice> j = launchingAdvice.iterator(); j.hasNext();) {
- IExecutableAdvice advice = j.next();
+ for (IExecutableAdvice advice : launchingAdvice) {
String[] jvmArgs = advice.getVMArguments();
for (int i = 0; i < jvmArgs.length; i++)
if (shouldPublishJvmArg(jvmArgs[i]) && !jvmSet.contains(jvmArgs[i])) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
index 1805a98f1..b66612fc4 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
@@ -11,7 +11,6 @@
package org.eclipse.equinox.p2.publisher.eclipse;
import java.util.Collection;
-import java.util.Iterator;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.publisher.eclipse.GeneratorBundleInfo;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
@@ -66,8 +65,7 @@ public class EquinoxLauncherCUAction extends AbstractPublisherAction {
*/
private void publishCU(String id, String configSpec, IPublisherResult results) {
Collection<IVersionAdvice> advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class);
- for (Iterator<IVersionAdvice> j = advice.iterator(); j.hasNext();) {
- IVersionAdvice versionSpec = j.next();
+ for (IVersionAdvice versionSpec : advice) {
Version version = versionSpec.getVersion(IInstallableUnit.NAMESPACE_IU_ID, id);
if (version == null)
continue;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
index 6c78cb381..242f193fd 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
@@ -113,12 +113,10 @@ public class FeaturesAction extends AbstractPublisherAction {
Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> locEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> locEntry : localizations.entrySet()) {
Locale locale = locEntry.getKey();
Map<String, String> translatedStrings = locEntry.getValue();
- for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
- Entry<String, String> entry = transIter.next();
+ for (Entry<String, String> entry : translatedStrings.entrySet()) {
iu.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
@@ -274,12 +272,10 @@ public class FeaturesAction extends AbstractPublisherAction {
Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> locEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> locEntry : localizations.entrySet()) {
Locale locale = locEntry.getKey();
Map<String, String> translatedStrings = locEntry.getValue();
- for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
- Entry<String, String> e = transIter.next();
+ for (Entry<String, String> e : translatedStrings.entrySet()) {
iu.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
@@ -362,12 +358,10 @@ public class FeaturesAction extends AbstractPublisherAction {
Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> locEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> locEntry : localizations.entrySet()) {
Locale locale = locEntry.getKey();
Map<String, String> translatedStrings = locEntry.getValue();
- for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
- Entry<String, String> e = transIter.next();
+ for (Entry<String, String> e : translatedStrings.entrySet()) {
iu.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
index 05e24cd01..f496956b6 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
@@ -145,8 +145,7 @@ public class ProductAction extends AbstractPublisherAction {
private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) {
Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class);
List<IVersionedId> result = new ArrayList<IVersionedId>();
- for (Iterator<IVersionedId> i = elements.iterator(); i.hasNext();) {
- IVersionedId element = i.next();
+ for (IVersionedId element : elements) {
Version elementVersion = element.getVersion();
if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) {
Iterator<IVersionAdvice> advice = versionAdvice.iterator();
@@ -174,8 +173,7 @@ public class ProductAction extends AbstractPublisherAction {
if (suffix == null || suffix.length() == 0)
return elements;
ArrayList<IVersionedId> result = new ArrayList<IVersionedId>(elements.size());
- for (Iterator<IVersionedId> i = elements.iterator(); i.hasNext();) {
- IVersionedId elementName = i.next();
+ for (IVersionedId elementName : elements) {
result.add(new VersionedId(elementName.getId() + suffix, elementName.getVersion()));
}
return result;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
index 5b2cb2b73..ae05ea81d 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
@@ -205,13 +205,11 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
}
List<BundleInfo> bundleInfos = product.getBundleInfos();
- for (Iterator<BundleInfo> i = bundleInfos.iterator(); i.hasNext();) {
+ for (BundleInfo bundleInfo : bundleInfos) {
// For each bundle that has configuration information, if the bundle is in the
// bundles bound by version, add the "configured" bundle instead
// If the bundle is not bound to a version, then replace all bounded versions
// with this one. Otherwise, just add this one (don't replace)
- BundleInfo bundleInfo = i.next();
-
if (versionBoundBundles.contains(bundleInfo)) {
// If we found a version with the same name and version, replace it with the "configured" bundle
data.removeBundle(bundleInfo);
@@ -222,8 +220,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
if (list == null)
data.addBundle(bundleInfo);
else
- for (Iterator<BundleInfo> iterator = list.iterator(); iterator.hasNext();) {
- BundleInfo target = iterator.next();
+ for (BundleInfo target : list) {
target.setStartLevel(bundleInfo.getStartLevel());
target.setMarkedAsStarted(bundleInfo.isMarkedAsStarted());
}
@@ -246,8 +243,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
Set<BundleInfo> set = new HashSet<BundleInfo>();
set.addAll(Arrays.asList(data.getBundles()));
- for (Iterator<IVersionedId> i = bundles.iterator(); i.hasNext();) {
- IVersionedId vid = i.next();
+ for (IVersionedId vid : bundles) {
BundleInfo bundleInfo = new BundleInfo();
bundleInfo.setSymbolicName(vid.getId());
bundleInfo.setVersion(vid.getVersion().toString());
@@ -264,8 +260,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
// Add all the bundles here. We replace / update them later
// if we find configuration information
List<IVersionedId> bundles = product.getBundles(true);
- for (Iterator<IVersionedId> i = bundles.iterator(); i.hasNext();) {
- IVersionedId vid = i.next();
+ for (IVersionedId vid : bundles) {
BundleInfo bundleInfo = new BundleInfo();
bundleInfo.setSymbolicName(vid.getId());
bundleInfo.setVersion(vid.getVersion().toString());
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
index 27010c29f..dbedd09c1 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
@@ -204,8 +204,7 @@ public class PublisherHelper {
if (iiu instanceof InstallableUnit) {
InstallableUnit iu = (InstallableUnit) iiu;
- for (Iterator<Entry<String, String>> iter = extraProperties.entrySet().iterator(); iter.hasNext();) {
- Entry<String, String> entry = iter.next();
+ for (Entry<String, String> entry : extraProperties.entrySet()) {
iu.setProperty(entry.getKey(), entry.getValue());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
index c2edc0716..11f604454 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
@@ -108,8 +108,7 @@ public abstract class AbstractPublishTask extends Task {
CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(getProvisioningAgent());
CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite(getProvisioningAgent());
- for (Iterator<RepoEntry> iterator = contextRepositories.iterator(); iterator.hasNext();) {
- RepoEntry entry = iterator.next();
+ for (RepoEntry entry : contextRepositories) {
if (contextMetadata != null && entry.isMetadataRepository())
contextMetadata.addChild(entry.getRepositoryLocation());
if (contextArtifact != null && entry.isArtifactRepository())
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
index 344b94a3b..45d393274 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
@@ -46,8 +46,7 @@ public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask {
private File[] getLocations(List<Object> collection) {
ArrayList<Object> results = new ArrayList<Object>();
- for (Iterator<Object> iterator = collection.iterator(); iterator.hasNext();) {
- Object obj = iterator.next();
+ for (Object obj : collection) {
if (obj instanceof FileSet) {
FileSet set = (FileSet) obj;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
index 58b2119cf..826bd0c3b 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
@@ -99,8 +99,7 @@ public class ProductPublisherTask extends AbstractPublishTask {
}
protected void processAdvice(PublisherInfo info) {
- for (Iterator<AdviceElement> iterator = advice.iterator(); iterator.hasNext();) {
- AdviceElement element = iterator.next();
+ for (AdviceElement element : advice) {
if (element.kind == null || element.file == null)
continue;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
index e643eb798..cb8f0fbd2 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
@@ -148,8 +148,7 @@ public class JarComparator implements IArtifactComparator {
Attributes attributes2 = manifest2.getMainAttributes();
if (attributes.size() != attributes2.size())
return false;
- for (Iterator<Entry<Object, Object>> iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
- Entry<Object, Object> entry = iterator.next();
+ for (Entry<Object, Object> entry : attributes.entrySet()) {
Object value2 = attributes2.get(entry.getKey());
if (value2 == null) {
return false;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
index eae358402..5a2c7dcc6 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
@@ -251,8 +251,7 @@ public class Mirroring {
srcProperties = srcDescriptors[src].getProperties();
// Cycle through properties of the originating descriptor & compare
- for (Iterator<String> iter = srcProperties.keySet().iterator(); iter.hasNext();) {
- String key = iter.next();
+ for (String key : srcProperties.keySet()) {
if (!srcProperties.get(key).equals(destMap.get(key))) {
if (verbose)
System.out.println(NLS.bind(Messages.Mirroring_differentDescriptorProperty, new Object[] {destDescriptors[dest], key, srcProperties.get(key), destMap.get(key)}));
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
index 260d23c19..a7707e467 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
@@ -86,11 +86,11 @@ public abstract class AbstractApplication {
protected void finalizeRepositories() throws ProvisionException {
if (removeAddedRepositories) {
IArtifactRepositoryManager artifactRepositoryManager = getArtifactRepositoryManager();
- for (Iterator<URI> iter = artifactReposToRemove.iterator(); iter.hasNext();)
- artifactRepositoryManager.removeRepository(iter.next());
+ for (URI uri : artifactReposToRemove)
+ artifactRepositoryManager.removeRepository(uri);
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
- for (Iterator<URI> iter = metadataReposToRemove.iterator(); iter.hasNext();)
- metadataRepositoryManager.removeRepository(iter.next());
+ for (URI uri : metadataReposToRemove)
+ metadataRepositoryManager.removeRepository(uri);
}
metadataReposToRemove = null;
artifactReposToRemove = null;
@@ -113,8 +113,7 @@ public abstract class AbstractApplication {
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
URI curLocation = null;
try {
- for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = iter.next();
+ for (RepositoryDescriptor repo : sourceRepositories) {
curLocation = repo.getRepoLocation();
if (repo.isBoth()) {
addRepository(artifactRepositoryManager, curLocation, 0, progress);
@@ -259,8 +258,7 @@ public abstract class AbstractApplication {
} catch (URISyntaxException e) {
//Can't happen
}
- for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = iter.next();
+ for (RepositoryDescriptor repo : sourceRepositories) {
if (repo.isMetadata())
compositeMetadataRepository.addChild(repo.getRepoLocation());
}
@@ -277,8 +275,7 @@ public abstract class AbstractApplication {
} catch (URISyntaxException e) {
//Can't happen
}
- for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = iter.next();
+ for (RepositoryDescriptor repo : sourceRepositories) {
if (repo.isArtifact())
compositeArtifactRepository.addChild(repo.getRepoLocation());
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
index c1ae3095d..3a70cf310 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
@@ -39,8 +39,7 @@ public class CompositeRepositoryApplication extends AbstractApplication {
CompositeArtifactRepository artifactRepo = (CompositeArtifactRepository) destinationArtifactRepository;
// Remove children from the Composite Repositories
- for (Iterator<RepositoryDescriptor> iterator = childrenToRemove.iterator(); iterator.hasNext();) {
- RepositoryDescriptor child = iterator.next();
+ for (RepositoryDescriptor child : childrenToRemove) {
if (child.isArtifact() && artifactRepo != null)
artifactRepo.removeChild(child.getOriginalRepoLocation());
if (child.isMetadata() && metadataRepo != null)
@@ -48,8 +47,7 @@ public class CompositeRepositoryApplication extends AbstractApplication {
}
// Add children to the Composite Repositories
- for (Iterator<RepositoryDescriptor> iterator = childrenToAdd.iterator(); iterator.hasNext();) {
- RepositoryDescriptor child = iterator.next();
+ for (RepositoryDescriptor child : childrenToAdd) {
if (child.isArtifact() && artifactRepo != null)
artifactRepo.addChild(child.getOriginalRepoLocation());
if (child.isMetadata() && metadataRepo != null)
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
index 779cc3c35..5a02fcca6 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
@@ -104,8 +104,7 @@ public class RecreateRepositoryApplication extends AbstractApplication {
throw new ProvisionException(NLS.bind(Messages.exception_notLocalFileRepo, repository.getLocation()));
IFileArtifactRepository simple = (IFileArtifactRepository) repository;
- for (Iterator<IArtifactKey> iterator = repoMap.keySet().iterator(); iterator.hasNext();) {
- IArtifactKey key = iterator.next();
+ for (IArtifactKey key : repoMap.keySet()) {
IArtifactDescriptor[] descriptors = repoMap.get(key);
String unpackedSize = null;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
index 409c63f86..0007b78bb 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
@@ -96,8 +96,8 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
DownloadManager dm = new DownloadManager(context, repositoryManager);
- for (Iterator<IArtifactRequest> it = artifactRequests.iterator(); it.hasNext();) {
- dm.add(it.next());
+ for (IArtifactRequest request : artifactRequests) {
+ dm.add(request);
}
return dm.start(monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
index 2bf388c36..a484aa28f 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
@@ -102,13 +102,11 @@ public abstract class AbstractRepositoryTask extends Task {
* Add source repositories to mirror from
*/
public void addConfiguredSource(RepositoryList sourceList) {
- for (Iterator<DestinationRepository> iter = sourceList.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = iter.next();
+ for (DestinationRepository repo : sourceList.getRepositoryList()) {
application.addSource(repo.getDescriptor());
}
- for (Iterator<FileSet> iter = sourceList.getFileSetList().iterator(); iter.hasNext();) {
- FileSet fileSet = iter.next();
+ for (FileSet fileSet : sourceList.getFileSetList()) {
sourceRepos.add(fileSet);
// Added to the application later through prepareSourceRepos
}
@@ -163,8 +161,7 @@ public abstract class AbstractRepositoryTask extends Task {
IMetadataRepository repository = application.getCompositeMetadataRepository();
List<IInstallableUnit> result = new ArrayList<IInstallableUnit>();
- for (Iterator<IUDescription> iter = iuTasks.iterator(); iter.hasNext();) {
- IUDescription iu = iter.next();
+ for (IUDescription iu : iuTasks) {
IQuery<IInstallableUnit> iuQuery = iu.createQuery();
Iterator<IInstallableUnit> queryResult = repository.query(iuQuery, null).iterator();
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
index 0859f34fc..98e479051 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools.tasks;
-import java.util.Iterator;
import org.apache.tools.ant.BuildException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
@@ -40,8 +39,7 @@ public class CompositeRepositoryTask extends AbstractRepositoryTask {
* Add the listed repositories to the composite repository
*/
public void addConfiguredAdd(RepositoryList list) {
- for (Iterator<DestinationRepository> iter = list.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = iter.next();
+ for (DestinationRepository repo : list.getRepositoryList()) {
((CompositeRepositoryApplication) application).addChild(repo.getDescriptor());
}
}
@@ -50,8 +48,7 @@ public class CompositeRepositoryTask extends AbstractRepositoryTask {
* Remove the listed repositories from the composite repository
*/
public void addConfiguredRemove(RepositoryList list) {
- for (Iterator<DestinationRepository> iter = list.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = iter.next();
+ for (DestinationRepository repo : list.getRepositoryList()) {
((CompositeRepositoryApplication) application).removeChild(repo.getDescriptor());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
index 198e6e0cd..8ca3f4551 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
@@ -61,8 +61,7 @@ public class RemoveIUTask extends AbstractRepositoryTask {
IArtifactRepository artifacts = application.getDestinationArtifactRepository();
final Set<IInstallableUnit> toRemove = new HashSet<IInstallableUnit>();
- for (Iterator<IUDescription> iter = iuTasks.iterator(); iter.hasNext();) {
- IUDescription iu = iter.next();
+ for (IUDescription iu : iuTasks) {
IQuery<IInstallableUnit> iuQuery = iu.createQuery();
IQueryResult<IInstallableUnit> queryResult = repository.query(iuQuery, null);
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
index 3944fe1c2..2eed5e2f1 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
@@ -12,7 +12,8 @@ package org.eclipse.equinox.internal.p2.persistence;
import java.io.*;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
@@ -43,13 +44,7 @@ public class CompositeParser extends XMLParser implements XMLConstants {
}
public URI[] getChildren() {
- int size = children.size();
- URI[] result = new URI[size];
- int i = 0;
- for (Iterator<URI> it = children.iterator(); it.hasNext(); i++) {
- result[i] = it.next();
- }
- return result;
+ return children.toArray(new URI[children.size()]);
}
public void startElement(String name, Attributes attributes) {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
index 2a7252bba..4f7268567 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
@@ -226,8 +226,7 @@ public class XMLWriter implements XMLConstants {
if (properties != null && properties.size() > 0) {
start(propertiesElement);
attribute(COLLECTION_SIZE_ATTRIBUTE, properties.size());
- for (Iterator<Entry<String, String>> iter = properties.entrySet().iterator(); iter.hasNext();) {
- Entry<String, String> entry = iter.next();
+ for (Entry<String, String> entry : properties.entrySet()) {
writeProperty(entry.getKey(), entry.getValue());
}
end(propertiesElement);
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
index 6e69be2fe..907d4e4c9 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
@@ -216,8 +216,7 @@ public class CacheManager {
* @param repositoryLocation
*/
void deleteCache(URI repositoryLocation) {
- for (Iterator<String> it = knownPrefixes.iterator(); it.hasNext();) {
- String prefix = it.next();
+ for (String prefix : knownPrefixes) {
File[] cacheFiles = getCacheFiles(repositoryLocation, prefix);
for (int i = 0; i < cacheFiles.length; i++) {
// delete the cache file if it exists
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
index 1e9c143b4..09500c2db 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
@@ -411,9 +411,8 @@ public class Credentials {
return;
// reset entries rather than creating a new empty map since the entries
// are also used as locks
- Iterator<HostEntry> itor = r.values().iterator();
- while (itor.hasNext())
- itor.next().reset();
+ for (HostEntry entry : r.values())
+ entry.reset();
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
index 311c8b42f..6b740e448 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
@@ -14,7 +14,8 @@ package org.eclipse.equinox.internal.p2.repository;
import java.net.URI;
import java.text.NumberFormat;
-import java.util.*;
+import java.util.SortedMap;
+import java.util.TreeMap;
import org.eclipse.osgi.util.NLS;
/**
@@ -97,10 +98,9 @@ public class ProgressStatistics {
long amount = 0L;
SortedMap<Long, Long> relevantData = m_recentSpeedMap.headMap(new Long(m_recentSpeedMapKey));
- Iterator<Long> itor = relevantData.values().iterator();
- while (itor.hasNext()) {
+ for (Long rl : relevantData.values()) {
dur += SPEED_RESOLUTION;
- amount += itor.next().longValue();
+ amount += rl.longValue();
}
if (dur >= 1000)
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index 2908a0df4..95d2c7189 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -21,7 +21,6 @@ import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.CompoundQueryable;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
@@ -464,9 +463,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
if (repositories == null)
restoreRepositories();
ArrayList<URI> result = new ArrayList<URI>();
- int i = 0;
- for (Iterator<RepositoryInfo<T>> it = repositories.values().iterator(); it.hasNext(); i++) {
- RepositoryInfo<T> info = it.next();
+ for (RepositoryInfo<T> info : repositories.values()) {
if (matchesFlags(info, flags))
result.add(info.location);
}
@@ -1018,8 +1015,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
boolean changed = false;
synchronized (repositoryLock) {
if (repositories != null) {
- for (Iterator<RepositoryInfo<T>> it = repositories.values().iterator(); it.hasNext();) {
- RepositoryInfo<T> info = it.next();
+ for (RepositoryInfo<T> info : repositories.values()) {
changed |= remember(info, false);
}
}
@@ -1090,9 +1086,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
}
}
try {
- @SuppressWarnings("unchecked")
- IQueryable<T>[] queryablesArray = queryables.toArray(new IQueryable[queryables.size()]);
- CompoundQueryable<T> compoundQueryable = new CompoundQueryable<T>(queryablesArray);
+ CompoundQueryable<T> compoundQueryable = new CompoundQueryable<T>(queryables);
return compoundQueryable.query(query, sub.newChild(locations.length * 1));
} finally {
sub.done();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
index 7c391de48..b2f599bca 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
@@ -102,9 +102,7 @@ public class DebugHelper {
StringBuffer buffer = new StringBuffer();
buffer.append('[');
- Iterator<? extends Entry<?, ?>> itor = map.entrySet().iterator();
- while (itor.hasNext()) {
- Entry<?, ?> e = itor.next();
+ for (Entry<?, ?> e : map.entrySet()) {
buffer.append(e.getKey());
buffer.append('=');
if (toString)
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index af067ff5c..a3838c071 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -1437,7 +1437,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public int countPlanElements(IProvisioningPlan plan) {
- return queryResultSize(new CompoundQueryable(new IQueryable[] {plan.getAdditions(), plan.getRemovals()}).query(InstallableUnitQuery.ANY, null));
+ return queryResultSize(new CompoundQueryable(plan.getAdditions(), plan.getRemovals()).query(InstallableUnitQuery.ANY, null));
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
index 912232529..613999143 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
@@ -160,7 +160,7 @@ public class CompoundQueryableTest extends TestCase {
};
public void testMatchQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -173,7 +173,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryable() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 2, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -182,7 +182,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleContextQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -190,7 +190,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMultipleContextQueries() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -198,7 +198,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testCompoundMatchAndQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {matchQuery, matchMod4query}, true), monitor);
assertEquals("1.0", 3, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -208,7 +208,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testCompoundMatchOrQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {matchQuery, matchMod4query}, false), monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -221,7 +221,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMatchQueryProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -229,7 +229,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryableProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -237,7 +237,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleContextQueryProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -245,7 +245,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMultipleContextQueriesProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -253,15 +253,15 @@ public class CompoundQueryableTest extends TestCase {
}
public void testNullProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {queryable1, queryable2});
+ CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
cQueryable.query(greatestNumberQuery, null);
// this is the same as above will null passed in, this should not throw any exceptions
}
public void testDoubleCompoundContextOrQuery() {
- CompoundQueryable cQueryable1 = new CompoundQueryable(new IQueryable[] {queryable3, queryable2});
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {cQueryable1, queryable1});
+ CompoundQueryable cQueryable1 = new CompoundQueryable(queryable3, queryable2);
+ CompoundQueryable cQueryable = new CompoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {contextQuery, greatestNumberQuery}, false), monitor);
assertEquals("1.0", 7, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -277,8 +277,8 @@ public class CompoundQueryableTest extends TestCase {
}
public void testDoubleCompositeQuery() {
- CompoundQueryable cQueryable1 = new CompoundQueryable(new IQueryable[] {queryable3, queryable2});
- CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {cQueryable1, queryable1});
+ CompoundQueryable cQueryable1 = new CompoundQueryable(queryable3, queryable2);
+ CompoundQueryable cQueryable = new CompoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(new PipedQuery(contextQuery, greatestNumberQuery), monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
index d8217122d..1fe6370a5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
@@ -141,8 +141,7 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public synchronized boolean contains(IArtifactKey key) {
- for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = iterator.next();
+ for (IArtifactDescriptor descriptor : repo.keySet()) {
if (descriptor.getArtifactKey().equals(key))
return true;
}
@@ -164,8 +163,7 @@ public class TestArtifactRepository implements IArtifactRepository {
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
Set<IArtifactDescriptor> result = new HashSet<IArtifactDescriptor>();
- for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = iterator.next();
+ for (IArtifactDescriptor descriptor : repo.keySet()) {
if (descriptor.getArtifactKey().equals(key))
result.add(descriptor);
}
@@ -297,8 +295,7 @@ public class TestArtifactRepository implements IArtifactRepository {
return Collector.emptyCollector();
Collector<IArtifactKey> collector = new Collector<IArtifactKey>();
- for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = iterator.next();
+ for (IArtifactDescriptor descriptor : repo.keySet()) {
collector.accept(descriptor.getArtifactKey());
}
return collector;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
index 82ff7cd64..858b53db7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
@@ -82,8 +82,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
}
private boolean hasRequest(List<IArtifactRequest[]> requests, IArtifactKey key) {
- for (Iterator<IArtifactRequest[]> iterator = requests.iterator(); iterator.hasNext();) {
- IArtifactRequest[] request = iterator.next();
+ for (IArtifactRequest[] request : requests) {
for (int i = 0; i < request.length; i++) {
if (key.equals(request[i].getArtifactKey()))
return true;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
index 4b91f1ba3..4adaf372f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
@@ -77,8 +77,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
}
private boolean hasRequest(List<IArtifactRequest[]> requests, IArtifactKey key) {
- for (Iterator<IArtifactRequest[]> iterator = requests.iterator(); iterator.hasNext();) {
- IArtifactRequest[] request = iterator.next();
+ for (IArtifactRequest[] request : requests) {
for (int i = 0; i < request.length; i++) {
if (key.equals(request[i].getArtifactKey()))
return true;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
index 0d48e41b8..8dde1bc81 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
@@ -34,8 +34,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public File getArtifactFile(IArtifactKey key) {
- for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = it.next();
+ for (IFileArtifactRepository repository : bundleRepositories) {
File artifactFile = repository.getArtifactFile(key);
if (artifactFile != null)
return artifactFile;
@@ -44,8 +43,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public File getArtifactFile(IArtifactDescriptor descriptor) {
- for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = it.next();
+ for (IFileArtifactRepository repository : bundleRepositories) {
File artifactFile = repository.getArtifactFile(descriptor);
if (artifactFile != null)
return artifactFile;
@@ -54,8 +52,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public boolean contains(IArtifactDescriptor descriptor) {
- for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = it.next();
+ for (IFileArtifactRepository repository : bundleRepositories) {
if (repository.contains(descriptor))
return true;
}
@@ -63,8 +60,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public boolean contains(IArtifactKey key) {
- for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = it.next();
+ for (IFileArtifactRepository repository : bundleRepositories) {
if (repository.contains(key))
return true;
}
@@ -73,8 +69,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
Set<IArtifactDescriptor> artifactDescriptors = new HashSet<IArtifactDescriptor>();
- for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = it.next();
+ for (IFileArtifactRepository repository : bundleRepositories) {
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
if (descriptors != null)
artifactDescriptors.addAll(Arrays.asList(descriptors));
@@ -108,19 +103,15 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// Query all the all the repositories
- @SuppressWarnings("unchecked")
- CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(bundleRepositories.toArray(new IQueryable[bundleRepositories.size()]));
+ CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(bundleRepositories);
return queryable.query(query, monitor);
}
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
- int repoCount = bundleRepositories.size();
- List<IQueryable<IArtifactDescriptor>> descQueryables = new ArrayList<IQueryable<IArtifactDescriptor>>(repoCount);
- for (Iterator<IFileArtifactRepository> itor = bundleRepositories.iterator(); itor.hasNext();)
- descQueryables.add(itor.next().descriptorQueryable());
-
- @SuppressWarnings("unchecked")
- IQueryable<IArtifactDescriptor> queryable = new CompoundQueryable<IArtifactDescriptor>(descQueryables.toArray(new IQueryable[repoCount]));
- return queryable;
+ List<IQueryable<IArtifactDescriptor>> descQueryables = new ArrayList<IQueryable<IArtifactDescriptor>>(bundleRepositories.size());
+ for (IFileArtifactRepository repository : bundleRepositories)
+ descQueryables.add(repository.descriptorQueryable());
+
+ return new CompoundQueryable<IArtifactDescriptor>(descQueryables);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
index 0727c2993..418166b79 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
@@ -57,8 +57,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
private void addRunningFeatures(IProfile profile, IArtifactRepository repositoryToGC) {
try {
List<Feature> allFeatures = getAllFeatures(Configuration.load(new File(Util.getConfigurationFolder(profile), "org.eclipse.update/platform.xml"), null)); //$NON-NLS-1$
- for (Iterator<Feature> iterator = allFeatures.iterator(); iterator.hasNext();) {
- Feature f = iterator.next();
+ for (Feature f : allFeatures) {
IArtifactKey match = searchArtifact(f.getId(), Version.create(f.getVersion()), ARTIFACT_CLASSIFIER_FEATURE, repositoryToGC);
if (match != null)
artifactKeyList.add(match);
@@ -73,8 +72,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
return CollectionUtils.emptyList();
List<Site> sites = cfg.getSites();
ArrayList<Feature> result = new ArrayList<Feature>();
- for (Iterator<Site> iterator = sites.iterator(); iterator.hasNext();) {
- Site object = iterator.next();
+ for (Site object : sites) {
Feature[] features = object.getFeatures();
for (int i = 0; i < features.length; i++) {
result.add(features[i]);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
index 94cbcb8bf..6fbdb174e 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
@@ -12,7 +12,6 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse;
import java.io.File;
import java.net.*;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.URLUtil;
@@ -104,8 +103,7 @@ public class PlatformConfigurationWrapper {
* Otherwise the default is USER-EXCLUDE.
*/
private String getDefaultPolicy() {
- for (Iterator<Site> iter = configuration.getSites().iterator(); iter.hasNext();) {
- Site site = iter.next();
+ for (Site site : configuration.getSites()) {
if (Site.POLICY_MANAGED_ONLY.equals(site.getPolicy()))
return Site.POLICY_MANAGED_ONLY;
}
@@ -135,8 +133,7 @@ public class PlatformConfigurationWrapper {
private Site getSite(URI url) {
List<Site> sites = configuration.getSites();
File file = URIUtil.toFile(url);
- for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
- Site nextSite = iter.next();
+ for (Site nextSite : sites) {
try {
File nextFile = URLUtil.toFile(new URL(nextSite.getUrl()));
if (nextFile == null)
@@ -156,8 +153,7 @@ public class PlatformConfigurationWrapper {
*/
private Site getSite(String id, String version) {
List<Site> sites = configuration.getSites();
- for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
- Site site = iter.next();
+ for (Site site : sites) {
Feature[] features = site.getFeatures();
for (int i = 0; i < features.length; i++) {
if (id.equals(features[i].getId()) && version.equals(features[i].getVersion()))
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
index fa3ceb779..05cccbfbf 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
@@ -126,9 +126,8 @@ public class Util {
if ((repoFilter & AGGREGATE_CACHE_EXTENSIONS) != 0) {
List<String> repos = getListProfileProperty(profile, CACHE_EXTENSIONS);
- for (Iterator<String> iterator = repos.iterator(); iterator.hasNext();) {
+ for (String repo : repos) {
try {
- String repo = iterator.next();
URI repoLocation;
try {
repoLocation = new URI(repo);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
index 501dde8b5..3ae304942 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
@@ -53,8 +53,7 @@ public class ConfigurationWriter implements ConfigurationConstants {
writer.startTag(ELEMENT_CONFIG, args);
- for (Iterator<Site> iter = configuration.internalGetSites(false).iterator(); iter.hasNext();) {
- Site site = iter.next();
+ for (Site site : configuration.internalGetSites(false)) {
write(writer, site, osgiInstallArea);
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
index b04581cc3..ff1f55396 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
@@ -50,8 +50,7 @@ public class Site {
public Feature getFeature(String id, String version) {
if (id == null)
return null;
- for (Iterator<Feature> iter = features.iterator(); iter.hasNext();) {
- Feature feature = iter.next();
+ for (Feature feature : features) {
if (id.equals(feature.getId())) {
if (version == null || version.equals(feature.getVersion()))
return feature;
@@ -61,8 +60,7 @@ public class Site {
}
public Feature removeFeature(String featureURL) {
- for (Iterator<Feature> iter = features.iterator(); iter.hasNext();) {
- Feature feature = iter.next();
+ for (Feature feature : features) {
String nextURL = feature.getUrl();
if (nextURL != null && nextURL.equals(featureURL))
return features.remove(feature) ? feature : null;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
index 27b2a8880..192f1d708 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
@@ -11,7 +11,6 @@
package org.eclipse.equinox.internal.p2.update;
import java.io.*;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -58,9 +57,8 @@ public class XMLWriter extends PrintWriter {
sb.append("<"); //$NON-NLS-1$
sb.append(name);
if (parameters != null)
- for (Iterator<String> it = parameters.keySet().iterator(); it.hasNext();) {
+ for (String key : parameters.keySet()) {
sb.append(" "); //$NON-NLS-1$
- String key = it.next();
sb.append(key);
sb.append("=\""); //$NON-NLS-1$
sb.append(getEscaped(String.valueOf(parameters.get(key))));
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
index 43bc3496c..82a3503cf 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
@@ -425,8 +425,8 @@ public class BackupStore implements IBackupStore {
// if there are unrestorable units log them
//
if (unrestorable != null && unrestorable.size() > 0) {
- for (Iterator<File> itor = unrestorable.iterator(); itor.hasNext();)
- logError(NLS.bind(Messages.BackupStore_manual_restore_needed, itor.next().getAbsolutePath()));
+ for (File file : unrestorable)
+ logError(NLS.bind(Messages.BackupStore_manual_restore_needed, file.getAbsolutePath()));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
index 8cab6b9a1..b394f0adf 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
@@ -80,8 +80,7 @@ public class CleanupcopyAction extends ProvisioningAction {
}
}
- for (Iterator<File> it = directories.iterator(); it.hasNext();) {
- File directory = it.next();
+ for (File directory : directories) {
File[] children = directory.listFiles();
if (children == null)
return Util.createError(NLS.bind(Messages.Error_list_children_0, directory));
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
index 1e86c500b..e442d4465 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
@@ -53,8 +53,7 @@ public class CleanupzipAction extends ProvisioningAction {
// we try to substitute the current target with what was written.
Map<String, String> iuProperties = profile.getInstallableUnitProperties(iu);
String sourcePrefix = UNZIPPED + ActionConstants.PIPE + source + ActionConstants.PIPE;
- for (Iterator<String> iterator = iuProperties.keySet().iterator(); iterator.hasNext();) {
- String key = iterator.next();
+ for (String key : iuProperties.keySet()) {
if (key.startsWith(sourcePrefix)) {
if (unzipped == null) {
iuPropertyKey = key;
@@ -96,8 +95,7 @@ public class CleanupzipAction extends ProvisioningAction {
// the leafs first in the list of directories.
// Since backup will deny backup of non empty directory a check must be made
//
- for (Iterator<File> it = directories.iterator(); it.hasNext();) {
- File directory = it.next();
+ for (File directory : directories) {
if (store != null) {
File[] children = directory.listFiles();
if (children == null || children.length == 0)
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
index 7a88e24ea..50b4633ae 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
@@ -162,9 +162,7 @@ public abstract class QueryableRepositoryManager<T> implements IQueryable<T> {
loadedRepos.add(repo);
}
if (loadedRepos.size() > 0) {
- @SuppressWarnings("unchecked")
- IQueryable<T>[] queryables = loadedRepos.toArray(new IQueryable[loadedRepos.size()]);
- return new CompoundQueryable<T>(queryables).query(query, sub.newChild(100));
+ return new CompoundQueryable<T>(loadedRepos).query(query, sub.newChild(100));
}
return Collector.emptyCollector();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
index bb3d4afd5..4a4f633b9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
@@ -59,8 +59,8 @@ public class RepositoryLocationQuery implements IQuery<URI> {
private URI getLocation(Object o) {
if (o instanceof URI)
return (URI) o;
- if (o instanceof IRepository)
- return ((IRepository) o).getLocation();
+ if (o instanceof IRepository<?>)
+ return ((IRepository<?>) o).getLocation();
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
index 5614d4aaf..7ab3f775d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
@@ -66,10 +66,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
// We use an additive check state cache so we need to remove
// previously checked items if the user unchecked them.
if (!event.getChecked() && checkState != null) {
- Iterator<Object> iter = checkState.iterator();
ArrayList<Object> toRemove = new ArrayList<Object>(1);
- while (iter.hasNext()) {
- Object element = iter.next();
+ for (Object element : checkState) {
if (checkboxViewer.getComparer().equals(element, event.getElement())) {
toRemove.add(element);
// Do not break out of the loop. We may have duplicate equal
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
index 05ead28ec..17be7ad91 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
@@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
@@ -111,9 +112,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
requirements = getIU().getRequiredCapabilities();
else {
ArrayList<IRequirement> capabilities = new ArrayList<IRequirement>();
- Iterator<IInstallableUnit> iter = ius.iterator();
- while (iter.hasNext()) {
- IInstallableUnit iu = iter.next();
+ for (IInstallableUnit iu : ius) {
capabilities.addAll(iu.getRequiredCapabilities());
}
requirements = capabilities;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
index 69d0bceef..31214f8f9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
@@ -11,11 +11,8 @@
package org.eclipse.equinox.internal.p2.ui.viewers;
-import org.eclipse.core.runtime.jobs.Job;
-
import java.text.NumberFormat;
import java.util.HashMap;
-import java.util.Iterator;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.equinox.internal.p2.ui.*;
@@ -230,11 +227,8 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
public void dispose() {
super.dispose();
- Iterator<Job> iter = jobs.values().iterator();
- while (iter.hasNext()) {
- Job job = iter.next();
+ for (Job job : jobs.values())
job.cancel();
- }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
index f61dccbec..f7777402a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
@@ -417,11 +417,8 @@ public class AcceptLicensesWizardPage extends WizardPage {
private void rememberAcceptedLicenses() {
if (licensesToIUs == null || manager == null)
return;
- Iterator<ILicense> iter = licensesToIUs.keySet().iterator();
- while (iter.hasNext()) {
- License license = (License) iter.next();
+ for (ILicense license : licensesToIUs.keySet())
manager.accept(license);
- }
}
private void setDescription() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
index 40d0ad4ea..0b7b203a9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
@@ -332,8 +332,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
RollbackProfileElement[] result = new RollbackProfileElement[2];
IStructuredSelection selection = ((IStructuredSelection) configsViewer.getSelection());
int i = 0;
- for (Iterator<?> iterator = selection.toList().iterator(); iterator.hasNext();) {
- Object selected = iterator.next();
+ for (Object selected : selection.toList()) {
if (selected != null && selected instanceof RollbackProfileElement) {
result[i++] = (RollbackProfileElement) selected;
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
index 5ac5f3adc..ec7b4a184 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
@@ -240,8 +240,7 @@ public class SiteModel {
this.localizations = localizations;
if (localizations != null && !localizations.isEmpty() && //
categories != null && !categories.isEmpty()) {
- for (Iterator<SiteCategory> catIter = categories.values().iterator(); catIter.hasNext();) {
- SiteCategory category = catIter.next();
+ for (SiteCategory category : categories.values()) {
category.setLocalizations(localizations);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
index 9eff4b1fe..cc5b951bb 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
@@ -97,10 +97,9 @@ public class SiteXMLAction extends AbstractPublisherAction {
private IStatus generateCategories(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) {
Map<SiteCategory, Set<IInstallableUnit>> categoriesToFeatureIUs = new HashMap<SiteCategory, Set<IInstallableUnit>>();
Map<SiteFeature, Set<SiteCategory>> featuresToCategories = getFeatureToCategoryMappings(info);
- for (Iterator<SiteFeature> i = featuresToCategories.keySet().iterator(); i.hasNext();) {
+ for (SiteFeature feature : featuresToCategories.keySet()) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
- SiteFeature feature = i.next();
IInstallableUnit iu = getFeatureIU(feature, info, results);
if (iu == null)
continue;
@@ -108,8 +107,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
// if there are no categories for this feature then add it to the default category.
if (categories == null || categories.isEmpty())
categories = defaultCategorySet;
- for (Iterator<SiteCategory> it = categories.iterator(); it.hasNext();) {
- SiteCategory category = it.next();
+ for (SiteCategory category : categories) {
Set<IInstallableUnit> featureIUs = categoriesToFeatureIUs.get(category);
if (featureIUs == null) {
featureIUs = new HashSet<IInstallableUnit>();
@@ -253,8 +251,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
* @param result The generator result being built
*/
protected void generateCategoryIUs(Map<SiteCategory, Set<IInstallableUnit>> categoriesToFeatures, IPublisherResult result) {
- for (Iterator<SiteCategory> it = categoriesToFeatures.keySet().iterator(); it.hasNext();) {
- SiteCategory category = it.next();
+ for (SiteCategory category : categoriesToFeatures.keySet()) {
result.addIU(createCategoryIU(category, categoriesToFeatures.get(category), null), IPublisherResult.NON_ROOT);
}
}
@@ -278,8 +275,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
cat.setProperty(IInstallableUnit.PROP_DESCRIPTION, category.getDescription());
ArrayList<IRequiredCapability> reqsConfigurationUnits = new ArrayList<IRequiredCapability>(featureIUs.size());
- for (Iterator<IInstallableUnit> iterator = featureIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : featureIUs) {
VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true);
reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, iu.getFilter() == null ? null : ((LDAPQuery) iu.getFilter()).getFilter(), false, false));
}
@@ -295,12 +291,10 @@ public class SiteXMLAction extends AbstractPublisherAction {
Map<Locale, Map<String, String>> localizations = category.getLocalizations();
if (localizations != null) {
- for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
- Entry<Locale, Map<String, String>> locEntry = iter.next();
+ for (Entry<Locale, Map<String, String>> locEntry : localizations.entrySet()) {
Locale locale = locEntry.getKey();
Map<String, String> translatedStrings = locEntry.getValue();
- for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
- Entry<String, String> e = transIter.next();
+ for (Entry<String, String> e : translatedStrings.entrySet()) {
cat.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(categoryId, locale));

Back to the top