package ap1;

import java.util.*;

/*
 * Given an array of strings, return a new List (e.g. an ArrayList) where
 * all the strings of the given length are omitted. See wordsWithout() below
 * which is more difficult because it uses arrays.
 * 
 * wordsWithoutList({"a", "bb", "b", "ccc"}, 1) --> {"bb", "ccc"}
 * wordsWithoutList({"a", "bb", "b", "ccc"}, 3) --> {"a", "bb", "b"}
 * wordsWithoutList({"a", "bb", "b", "ccc"}, 4) --> {"a", "bb", "b", "ccc"}
 */

public class WordsWithoutListTest {
    public static void main(String[] args) {
		WordsWithoutListTest test = new WordsWithoutListTest();
		System.out.println(test.wordsWithoutList(
						   new String[] {"a", "bb", "b", "ccc"}, 1));
		System.out.println(test.wordsWithoutList(
						   new String[] {"a", "bb", "b", "ccc"}, 3));
		System.out.println(test.wordsWithoutList(
						   new String[] {"a", "bb", "b", "ccc"}, 4));
	}
	
	public List wordsWithoutList(String[] words, int len) {
	    ArrayList<String> newWords = new ArrayList<String>();
	    
	    for (int i = 0; i < words.length; i++) {
	        if (words[i].length() != len) {
	            newWords.add(words[i]);
	        }
	    }
	    return newWords;
	}
}
@@ -897,16 +897,24 @@
 lic List
+%3CString%3E
  wordsWi
@@ -1183,8 +1183,9 @@
 ds;%0A%09%7D%0A%7D
+%0A

Update WordsWithoutListTest