title: Anything wrong about my Intset Class?
body: <p>I design new IntSet Class that use ArrayList. first, i extends Intset by ArrayList and i start implement method. i face some problem in my union() method. here is my code...</p>
  
  <pre><code>public class IntSet extends ArrayList&lt;Integer&gt;{
  
      private static final long serialVersionUID = 1L;
      private ArrayList&lt;Integer&gt; intset;
  
      public IntSet(){
          this.intset = new ArrayList&lt;Integer&gt;();
      }
      public IntSet(ArrayList&lt;Integer&gt; intset){
          this.intset = intset;
      }
  
      public void insert(int x){
          this.intset.add(x);
      }
  
      @Override
      public Integer remove(int x){
          int index = intset.indexOf(x);
          this.intset.remove(index);
          return 1;
      }
  
      @Override
      public int size(){
          return this.intset.size();
      }
  
      @Override
      public Integer get(int index){
          return this.intset.get(index);
      }
  
      public boolean member(int x){
          if(intset.indexOf(x)==-1) return false;
          else return true;
      }
  
      public IntSet union(IntSet a){
          IntSet intersectSet = new IntSet();
          intersectSet.insert(0);
          intersectSet.insert(1);
          System.out.println(intersectSet.size());
          System.out.println(intersectSet.contains(1));
          for(int i=0; i&lt;a.size(); i++){
          }
          return intersectSet;
      }
  
      public String toString(){
          if(intset.size()==0) return "[]";
          String s = "[" + intset.get(0).toString();
          for(int i=1; i&lt;intset.size(); i++){
              s += "," + intset.get(i).toString();
          }
          return s += "]";
      }
  
  }
  </code></pre>
  
  <p>In method </p>
  
  <pre><code>union(IntSet a);
  </code></pre>
  
  <p>I constract new Intset object then add 2 value (0, 1) into <strong>intersectSet</strong> variable.</p>
  
  <pre><code>intersectSet.insert(0);
  intersectSet.insert(1);
  </code></pre>
  
  <p>then i print size of <strong>intersectSet</strong> it shown me 2 that is correct!</p>
  
  <p>but when i need to check that there is 1 in <strong>intersectSet</strong> or not? it shown me false.</p>
  
  <pre><code>System.out.println(intersectSet.contains(1));
  </code></pre>
  
  <p>In fact it should show me true because in <strong>intersectSet</strong> have integer 1.</p>
  
  <p>anything wrong about my code and should i extends ArrayList for IntSet class?</p>