title: Performing the fastest search - which collection should i use?
body: <p>I know:</p>
  
  <ul>
  <li>If you need fast access to elements using index, ArrayList should be choice.</li>
  <li>If you need fast access to elements using a key, use HashMap.</li>
  <li>If you need fast add and removal of elements, use LinkedList (but it has a very poor seeking performance).</li>
  </ul>
  
  <p>In order to perform the fastest search, on the basis of data stored in a collection object, which collection should I use?</p>
  
  <p>Below is my code:</p>
  
  <pre><code>    public void fillAndSearch(Collection&lt;Student&gt; collection) {
        if(collection!=null){
          for (int i=0; i&lt;=10; i++) {
              Student student = new Student("name" + i, "id" + i);
              collection.add(student);
          }
        }
          //here We have to perform searching for "name7" or "id5",
          //then which implementation of collection will be fastest?
      }
  
  class Student {
      String name;
      String id;
  
      Student(String name, String id) {
          this.name = name;
          this.id = id;
      }
  } 
  </code></pre>