title: Java - How to load CSV in Map data structure with key and values as POJO - Map<ClassA, ClassB>
body: <p>I have a CSV file with datapoints as</p>
  
  <pre><code>student, year, subject, score1, score2, score3, ..., score100
  Alex, 2010, Math, 23, 56, 43, ..., 89
  Alex, 2011, Science, 45, 32, 45, ..., 65
  Matt, 2009, Art, 34, 56, 75, ..., 43
  Matt, 2010, Math, 43, 54, 54, ..., 32
  </code></pre>
  
  <p>What would be the best way to load such CSV as Map in Java. This data is used for lookup service hence the chosen map data structure. The key would be the Tuple (student, year) -> which returns a list of subject + scores (SubjectScore.class). So the idea is given the name of the student and year, get all subjects and scores.</p>
  
  <p>I didn't find an elegant solution while searching to read the CSV file in a Map of defined classes like <code>Map&lt;Tuple, List&lt;SubjectScore&gt;&gt;</code></p>
  
  <pre><code>class Tuple {
    private String student;
    private int year;
  }
  
  class SubjectScore {
    private String subject;
    private int score1;
    private int score2;
    private int score3;
    // more fields here
    private int score100;
  }
  </code></pre>
  
  <p>Additional details: The CSV file is large ~ 2 GB but is static in nature, hence deciding to load in memory.</p>