title: Get some value from List<Object> Java
body: <p>I think it quite simple but I need one ways to solve it easy.</p>
  
  <p>My problem is: I have list object Student include 100 objects</p>
  
  <pre><code>public class Student {
  
  private String id;
  private String name;
  private int age;
  
  
  public String getId() {
      return id;
  }
  public void setId(String id) {
      this.id = id;
  }
  
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  }
  
  public int getAge() {
      return age;
  }
  public void setAge(int age) {
      this.age = age;
  }
  </code></pre>
  
  <p>Now, I only want to get age of some student has name "ABC", "BCD", "DEF"</p>
  
  <p>So I will do it:</p>
  
  <pre><code>Map&lt;String, String&gt; data = new HashMap&lt;&gt;();
      List&lt;String&gt; listSpecification = new ArrayList&lt;&gt;(Arrays.asList("ABC", "BCD", "DEF"));
      for (Student stu : list&lt;Student&gt;) {
          for (int i = 0; i &lt; listSpecification.size(); i++) {
              if (stu.getName().equalsIgnoreCase(listSpecification.get(i))) {
                  data.put(pro.getName(), pro.getValue());
              }
          }
      }
  </code></pre>
  
  <p>But if I do it, I think it not good about performance. So anyone can help me another case ?</p>