title: Create sub-list and remove values from previous list
body: <p>I want to create a sub-list in Java and remove values that are in sub-list from the previous List. My program correctly creates sub-list, but than it doesn't remove the correct values from previous-list.</p>
  <p>My code:</p>
  <pre><code>for (int i = 0; i &lt; 4; i++) {
       List&lt;Object&gt; sub = new ArrayList&lt;Object&gt;(prevoiusList.subList(0, 6));
  
       for (int j = 0; j &lt; 6; j++) {
           previousList.remove(j);
       }
  }    
  </code></pre>