title: How can I "Round-Robin" 2 ArrayLists?
body: <p>I have an assignment for school where I need to make a programme that automatically makes couples for the lessons at school. In this case there are 6 lessons and each lesson you partner with a different person. So in week 1 person <code>a</code> partnered with person <code>b</code> and the following weeks he can't partner with person <code>a</code>.</p>
  <p>I have written some code that splits the class in 2, but I have no idea on how I could change the couples every week.</p>
  <p>Here is the code I already have (sorry it isn't in english):</p>
  <pre class="lang-java prettyprint-override"><code>public void maakKoppels() {
      if (leerlingenLijst.size() % 2 == 1) {
          // if you have an odd number of students it adds the &quot;Bye&quot; student
          leerlingenLijst.add(new Leerling(&quot;Bye&quot;));
      }
  
      for (int i = 1; i &lt;= 6; i++) {
          //its needed for 6 lessons so it does it 6 times
          maakKoppels(i, leerlingenLijst);
      }
  }
  
  public void maakKoppels(int weekNum, ArrayList&lt;Leerling&gt; leerlingenLijst) {
      int midden = leerlingenLijst.size() / 2; //split the arraylist in 2
  
      ArrayList lijst1 = new ArrayList();
      for (int j = 0; j &lt; midden; j++) {
          lijst1.add(leerlingenLijst.get(j));
      }
  
      ArrayList lijst2 = new ArrayList();
      for (int j = leerlingenLijst.size() - 1; j &gt;= midden; j--) {
          lijst2.add(leerlingenLijst.get(j));
      }
      // here it fills the lessons with the 2 lists. weekNum is the lesson
      // number and the name on lijst1 at index 0 couples with the name on
      // lijst2 at index zero
      practica.add(new Practicum(weekNum, lijst1, lijst2));
  }
  </code></pre>