title: whats wrong with this code? It is not filtering the collection!
body: <pre><code>public class CollectionsFilter {
  
      public static void main(String[] args) {
          List&lt;Integer&gt; list = Arrays.asList(new Integer[] { 1, 2, 3, 4, 5, 6, 7,
                  8, 9, 10 });
          Collection&lt;Integer&gt; evenNumbers = Utils.filter(list,
                  new Predicate&lt;Integer&gt;() {
                      public boolean apply(Integer i) {
                          if (i % 2 == 0) {
                              return true;
                          }
                          return false;
                      }
                  });
  
          Collection&lt;Integer&gt; oddNumbers = Utils.filter(list,
                  new Predicate&lt;Integer&gt;() {
                      public boolean apply(Integer i) {
                          if (i % 2 != 0) {
                              return true;
                          }
                          return false;
                      }
                  });
          System.out.println("EVEN Numbers &gt; " + evenNumbers);
          System.out.println("ODD Numbers &gt; " + oddNumbers);
      }
  
  }
  </code></pre>
  
  <p>where my Utils.filter() method is :</p>
  
  <pre><code>public static &lt;T&gt; Collection&lt;T&gt; filter(Collection&lt;T&gt; target,
              Predicate&lt;T&gt; predicate) {
          Collection&lt;T&gt; filteredCollection = new ArrayList&lt;T&gt;();
          for (T t : filteredCollection) {
              if (predicate.apply(t)) {
                  filteredCollection.add(t);
              }
          }
          return filteredCollection;
      }
  </code></pre>
  
  <p>and the Prdicate:</p>
  
  <pre><code>public interface Predicate&lt;T&gt; {
      public boolean apply(T type);
  }
  </code></pre>