diff options
author | Adam Domurad <[email protected]> | 2012-05-25 11:44:13 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2012-05-25 11:44:13 -0400 |
commit | 1705caf0db175cb9537313e5c1d9df14186f5bea (patch) | |
tree | 53e206445b682f387d27f3ba762eb70899caefa3 /netx/net/sourceforge/jnlp/ResourcesDesc.java | |
parent | ef79a2eab042f66aa10a2356d9a6f80f5b8d544f (diff) |
Changed for-loops over iterators and indices to for-each loops if they
were sufficient and clearer.
Diffstat (limited to 'netx/net/sourceforge/jnlp/ResourcesDesc.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/ResourcesDesc.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/netx/net/sourceforge/jnlp/ResourcesDesc.java b/netx/net/sourceforge/jnlp/ResourcesDesc.java index 4c861b5..42eec01 100644 --- a/netx/net/sourceforge/jnlp/ResourcesDesc.java +++ b/netx/net/sourceforge/jnlp/ResourcesDesc.java @@ -75,9 +75,10 @@ public class ResourcesDesc { public JARDesc getMainJAR() { JARDesc jars[] = getJARs(); - for (int i = 0; i < jars.length; i++) - if (jars[i].isMain()) - return jars[i]; + for (JARDesc jar : jars) { + if (jar.isMain()) + return jar; + } if (jars.length > 0) return jars[0]; @@ -160,8 +161,7 @@ public class ResourcesDesc { public Map<String, String> getPropertiesMap() { Map<String, String> properties = new HashMap<String, String>(); List<PropertyDesc> resources = getResources(PropertyDesc.class); - for (int i = 0; i < resources.size(); i++) { - PropertyDesc prop = resources.get(i); + for (PropertyDesc prop : resources) { properties.put(prop.getKey(), prop.getValue()); } @@ -205,9 +205,10 @@ public class ResourcesDesc { public <T> List<T> getResources(Class<T> type) { List<T> result = new ArrayList<T>(); - for (int i = 0; i < resources.size(); i++) - if (type.isAssignableFrom(resources.get(i).getClass())) - result.add(type.cast(resources.get(i))); + for (Object resource : resources) { + if (type.isAssignableFrom(resource.getClass())) + result.add(type.cast(resource)); + } return result; } |