title: check out my Java Generic's Wildcard
body: <p>In the below code , I do not know if I coded correctly the last method which is <code>public boolean addAll(SimpleSet&lt;? extends E&gt; s) {</code>
  Can you check it out if it is correct (please explain to me how <code>(SimpleSet&lt;? extends E&gt; s)</code> works) and look at the other methods as well !</p>
  
  <pre><code>package set;
      import java.util.ArrayList;
      import java.util.Iterator;
  
  public class ArraySet&lt;E&gt; implements SimpleSet&lt;E&gt; {
      private ArrayList&lt;E&gt; data=new ArrayList&lt;E&gt;();
  
      /**
       * Constructs a new empty set.
       */
      public ArraySet() {
  
      }
  
      /** 
       * Adds the specified element to this set, if it is not already present.
       * post: x is added to the set if it is not already present
       * @param  x the element to be added
       * @return true if the specified element was added
       */
      public boolean add(E x) {
          for(int i=0; i&lt;data.size(); i++){
              if(data.get(i).equals(x)){
                  System.out.println("x is already added");
              } else {
                  data.add(x);
                  System.out.println("x is added to the set");
  
                  return true;
              }
          }
          return false;
      }
  
      /** 
       * Removes the specified element from this set if it is present. 
       * post:    x is removed if it was present
       * @param   x the element to remove - if present
       * @return true if the set contained the specified element
       */
      public boolean remove(Object x) {   
          for(int i=0; i&lt;data.size(); i++){
              if(data.get(i).equals(x)){
                  data.remove(x);
                  return false;
              }
      }
          return true;
      }
  
      /** 
       * Returns true if this set contains the specified element.
       * @param   x the element whose presence is to be tested
       * @return  true if this set contains the specified element
       */
      public boolean contains(Object x) {     
          for(int i=0; i&lt;data.size(); i++){
              if(data.get(i).equals(x)){
                  return true;
              }
      }       
          return false;
      }
  
  
      /** 
       * Returns true if this set contains no elements.
       * @return true if this set contains no elements
       */
      public boolean isEmpty() {  
          if(data.size()==0){
              return true;
          }
          return false;
      }
  
      /** 
       * Returns the number of elements in this set.
       * @return the number of elements in this set
       */
      public int size() {
          return data.size();
      }
  
      /** 
       * Returns an iterator over the elements in this set.
       * @return an iterator over the elements in this set
       */
      public Iterator&lt;E&gt; iterator() {
          return this.iterator();
  
      }
  
      /**
      * Adds all of the elements in the specified set, for which it is
      * possible, to this set.
      * post: all elements, for which it is possible, in the
      * specified set are added to this set.
      * @return true if this set changed as a result of the call
      */
      public boolean addAll(SimpleSet&lt;? extends E&gt; s) {
          for(E e : s){
              data.add(e);
              System.out.println("all elements, for which it is possible, in the specified set are added to this set. ");
              return true;
          }
          return false;
      }
  
  }
  </code></pre>