title: Pointer, Vector and Iterator in Java
body: <p>I've got some C++ codes about vector, pointer and iterator. But I'm not sure about what the codes do. I guess, it does iteration using iterator to get or check every single vector value, then when value inner vector still doesn't end or has next, it will create a vector name v that is filled with pointer from d. Is it right? Now, I want to convert that code into java code, especially Java Android. So far, I have converted until WHILE section. I don't have any idea for converting section create new vector with pointer. Could you help me? Thank you so much. </p>
  
  <p>C++ Code :</p>
  
  <pre><code>size_t count = contours_hull[i].size();
  if( count &lt; 300 )
     continue;
  vector&lt;Vec4i&gt;::iterator d =defects[i].begin();
  while( d!=defects[i].end() ) {
      Vec4i&amp; v=(*d); //this line, i can't convert.
  //another code
  }
  </code></pre>
  
  <p>Java Code that I did it :</p>
  
  <pre><code>for(int i = 0; i &lt; contours_hull.size(); i++) // I added this line, because in java "continue" cannot use in outside loop, so i make loop here.
  {
      int count = contours_hull.size();
      if (count &lt; 300) continue;
      List&lt;MatOfInt4&gt; defect = new ArrayList&lt;MatOfInt4&gt;();
      Iterator d =  defect.iterator();
      while (d.hasNext)
      {
          //the line "Vec4i&amp; v=(*d);" that i can't convert
      }
  }
  </code></pre>
  
  <p>Is it right to convert them like that? And what should i write for the code that hasn't converted? Anyone, Could you help me ???</p>