title: Correct usage of storing objects in maps
body: <p>Say I need to store a collection of Student objects and each student has a unique id. One option is to store all of them in a list, but then when searching for a student, I'd have to perform a linear search and check their id's. The other option would be to use a map, of something like: Map where the keys are the student id's that map to the actual student objects.</p>
  
  <p>Is this a sensible approach for the given problem? On the one hand it feels right because I can easily retrieve a student by their id, however, on the other hand, it feels like I'm slightly redundantly storing the id, which already exists within the student object - so I'm sort of storing it twice, but the key is the lookup mechanism.</p>
  
  <p>My add would be something like:</p>
  
  <pre><code>public void add(Student s) {
       lookup.put(s.getId(), s);
  }
  </code></pre>