title: How can I correct my method so that it removes string from array?
body: <p>I am trying to create a method that searches through the 'data' array to find the parameter 'elt'.  If it exists, the method deletes it.  I cannot figure out how to delete the string "elt".  Below is what I have so far.</p>
  
  <pre><code>public class Bag&lt;T&gt; implements Iterable&lt;T&gt; {
  
  private final int MAXLEN = 3;
  private int size;
  private T[] data; // array
  
  public T remove(T elt) {
  
      for (T word : data) {
          if (word == "elt")
              data = data.remove(word);
          }
      }       
  }
  </code></pre>
  
  <p>The error I get is "Cannot remove(T) on the array type T[].  </p>
  
  <p>Can someone tell me how I can properly remove the string "elt" from the array?</p>