title: Java for loop only storing last value
body: <p>I have a <code>for</code> loop in <code>java</code> android and it runs perfectly but it only stores to the last item in the list it is looping through. Should I make <code>user_id</code> and <code>lesson_id</code> a list? I don't know where to go from here but here is what I have done. The logic works fine but it only saves one item from the lists in both variables.</p>
  
  <p>Android Studio Code:</p>
  
  <pre><code>// loop to add every user and lesson selected to watch
  String user_id = null;
  int lesson_id = 0;
  
  for (int i = 0; i&lt;attendees.size(); i++){
      for (int j = 0; j&lt;lesson_iDs.size(); j++){
           user_id = attendees.get(i);
           lesson_id = lesson_iDs.get(j);
      }
  }
  // get the date for the classWatch
  Calendar localCalendar = Calendar.getInstance(TimeZone.getDefault());
  Date currentTime = localCalendar.getTime();
  
  // to show in patient activity (sends to SQLite)
  watch = new Watch(currentTime, user_id, lesson_id);
  </code></pre>