title: Executor service returning incorrect response
body: <p>I am creating future list from a list of calls to executor service submit method based on student ID. The response from service is not returning for all studentId's. It runs for the right number of times but the studentId getting used in service call is either first or last. It is ignoring the middle ones. Please check the code below</p>
  <pre><code>private List&lt;Student&gt; studentTask() {
          ExecutorService executor = Executors.newFixedThreadPool(5);
          List&lt;Future&lt;List&lt;Student&gt;&gt;&gt; tasks = new ArrayList&lt;&gt;();
          for(int studentNumber = 1; studentNumber &lt;= 10; studentNumber++) {
              Callable&lt;List&lt;Student&gt;&gt; task = new StudentService(studentNumber);
              Future&lt;List&lt;Student&gt;&gt; recordTask = executor.submit(task);
              tasks.add(recordTask);
          }
          try {
              for (Future&lt;List&lt;Student&gt;&gt; future : tasks) {
                  List&lt;Student&gt; student = future.get();
                  //...
              }
              return //studentList;
          } catch (Exception e) {
          }
      }
  
  private class StudentService implements Callable&lt;List&lt;Student&gt;&gt;{
     private int studentId;
      
     StudentService(int studentId){
       this.studentId = studentId;
     }
      
     public List&lt;Student&gt; call(){
       return getStudentNames(this.studentId);
     }
   }
  
  public class Student{
     private String studentName;
     private int StudentId;
  
     //Parameterized Constructor
  }
  
  private List&lt;Student&gt; getStudentNames(int studentId){
     List&lt;Student&gt; studentList = // db call returning all student with 
                                 // respect to studentId.
     return studentList;
  }
  </code></pre>
  <p>In the below code the service is getting called 10 times but for only student Id <strong>1</strong> and <strong>10</strong>. Not able to get result of <strong>2</strong> to <strong>9</strong> which is resulting in an inaccurate result.
  Need help in understanding if i am missing anything here.</p>