diff options
author | Tom Tromey <tromey@redhat.com> | 2008-10-16 17:20:18 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2008-10-16 17:20:18 +0000 |
commit | 8b5b3ea82d7cabe09b0a89c9f896e9b25e308091 (patch) | |
tree | 31d6f6973a48b8e46a5641d1c2b05c971590bc9c /tools | |
parent | 4fc42f7091daa2e7262f55117ffbd8e70d9599b3 (diff) | |
download | classpath-8b5b3ea82d7cabe09b0a89c9f896e9b25e308091.tar.gz |
* tools/gnu/classpath/tools/jar/WorkSet.java (initSet): Use
foreach. Change argument type.
(WorkSet): Change argument type.
* tools/gnu/classpath/tools/jar/Indexer.java (indexJarFile): Use
foreach.
* tools/gnu/classpath/tools/jar/Creator.java
(writeCommandLineEntries): Use foreach.
(getAllEntries): Likewise.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gnu/classpath/tools/jar/Creator.java | 21 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jar/Indexer.java | 8 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jar/WorkSet.java | 11 |
3 files changed, 13 insertions, 27 deletions
diff --git a/tools/gnu/classpath/tools/jar/Creator.java b/tools/gnu/classpath/tools/jar/Creator.java index eef31e7e0..a6b6112ca 100644 --- a/tools/gnu/classpath/tools/jar/Creator.java +++ b/tools/gnu/classpath/tools/jar/Creator.java @@ -1,5 +1,5 @@ /* Creator.java - create a new jar file - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2008 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,7 +49,6 @@ import java.io.OutputStream; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; @@ -179,13 +178,9 @@ public class Creator private ArrayList<Entry> getAllEntries(Main parameters) { - Iterator it = parameters.entries.iterator(); ArrayList<Entry> allEntries = new ArrayList<Entry>(); - while (it.hasNext()) - { - Entry entry = (Entry) it.next(); - addEntries(allEntries, entry); - } + for (Entry entry : parameters.entries) + addEntries(allEntries, entry); return allEntries; } @@ -196,13 +191,9 @@ public class Creator writtenItems.add("META-INF/"); //$NON-NLS-1$ writtenItems.add(JarFile.MANIFEST_NAME); - ArrayList allEntries = getAllEntries(parameters); - Iterator it = allEntries.iterator(); - while (it.hasNext()) - { - Entry entry = (Entry) it.next(); - writeFile(entry.file, entry.name, parameters.verbose); - } + ArrayList<Entry> allEntries = getAllEntries(parameters); + for (Entry entry : allEntries) + writeFile(entry.file, entry.name, parameters.verbose); } protected Manifest createManifest(Main parameters) diff --git a/tools/gnu/classpath/tools/jar/Indexer.java b/tools/gnu/classpath/tools/jar/Indexer.java index 06c5de9fb..217b64405 100644 --- a/tools/gnu/classpath/tools/jar/Indexer.java +++ b/tools/gnu/classpath/tools/jar/Indexer.java @@ -1,5 +1,5 @@ /* Indexer.java -- add index.list file to jar - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2008 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,7 +46,6 @@ import java.io.IOException; import java.io.OutputStream; import java.text.MessageFormat; import java.util.Enumeration; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.StringTokenizer; import java.util.jar.Attributes; @@ -90,10 +89,9 @@ public class Indexer result.append(fileName); // Any line ending will do. result.append('\n'); - Iterator i = entries.iterator(); - while (i.hasNext()) + for (String s : entries) { - result.append(i.next()); + result.append(s); result.append('\n'); } // Paragraph break. diff --git a/tools/gnu/classpath/tools/jar/WorkSet.java b/tools/gnu/classpath/tools/jar/WorkSet.java index c085516c6..d4b7f1eac 100644 --- a/tools/gnu/classpath/tools/jar/WorkSet.java +++ b/tools/gnu/classpath/tools/jar/WorkSet.java @@ -1,5 +1,5 @@ /* WorkSet.java -- Helper to track what files to work on - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2008 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,21 +40,18 @@ package gnu.classpath.tools.jar; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; public class WorkSet { private HashSet<String> allItems; - private void initSet(ArrayList entries) + private void initSet(ArrayList<Entry> entries) { if (entries == null || entries.isEmpty()) return; allItems = new HashSet<String>(); - Iterator it = entries.iterator(); - while (it.hasNext()) + for (Entry entry : entries) { - Entry entry = (Entry) it.next(); int len = entry.name.length(); while (len > 0 && entry.name.charAt(len - 1) == '/') --len; @@ -63,7 +60,7 @@ public class WorkSet } } - public WorkSet(ArrayList entries) + public WorkSet(ArrayList<Entry> entries) { initSet(entries); } |