title: Recursive with void method?
body: <p>I have a problem with one of my program (my programming language is java) : 
  I have an object Douglas-Peucker which is an array of Points and I have an algorithm, the Douglas-Peucker algorithm. I want to work directly on this array of Points and here the problem begin. This is Douglas-Peucker algorithm : </p>
  
  <pre><code>protected Point[] coinImage;
  </code></pre>
  
  <p>// My constructor</p>
  
  <pre><code>public Peucker(Point [] tab) {
      coinImage = new Point[tab.length];
      for(int i = 0; i &lt; coinImage.length; i++) {
          coinImage[i] = new Point(tab[i].x, tab[i].y);
      }
  }
  public Point[] algoDouglasPeucker() {
      return douglasPeuckerAux(0,coinImage.length - 1);
  }
  
  public Point[] douglasPeuckerAux(int startIndex, int endIndex) {
      double dmax = 0;
      int index = 0;
      for(int i  = startIndex + 1; i &lt; endIndex; i++) {
          double distance = this.distancePointSegment(this.coinImage[i], this.coinImage[startIndex], this.coinImage[endIndex]);
          if(distance &gt; dmax) {
              index = i;
              dmax = distance;
          }
      } ***
      if(dmax &gt;= this.epsilon) {
          Point[] recResult1 = douglasPeuckerAux(startIndex,index);
          Point[] recResult2 = douglasPeuckerAux(index,endIndex);
          Point [] result = this.unionTabPoint(recResult1, recResult2);
          return result;
      }
      else {
          return new Point[] { coinImage[0],coinImage[endIndex] };
          }
  } 
  
  *** my problem is here : both methods have a specific type of return : array of Point or I want to change this because I want to work directly on my attribut (coinImage).
  </code></pre>
  
  <p>How change this in void methods ? 
  Help me please ! 
  Sorry I forget one method : I also want to change the type of this method : </p>
  
  <pre><code>    public Point[] unionTabPoint(Point [] P1,Point [] P2) {
      Point[] res = new Point[P1.length + P2.length];
      for(int i = 0; i &lt; P1.length;i++) {
          res[i] = new Point(P1[i].x,P1[i].y);
      }
      int k = 0;
      for(int j = P1.length; j &lt; res.length; j++) {
          res[j] = new Point(P2[k].x,P2[k].y);
          k++;
      }
      return res;
  }
  </code></pre>
  
  <p>She return the union of two array but without specific order. </p>