java 代码
- List<string> wordList = </string>new LinkedList<string>(); </string>
- // Assign some words
- for (int i=0; i
- wordList.add("word " + (i+1) + ": " '" + args[i] + "'");
- }
- // Remove all words with "1" in them.
- Impossible with for/in!
- for (Iterator i = wordList.iterator(); i.hasNext(); ) {
- String word = (String)i.next();
- if (word.indexOf("1") != -1) {
- i.remove();
- }
- }