title: Iterating through generic List of Object type
body: <p>I am trying to get values from a  object type generic List. And I want to put some condition on value of one attribute of that class.
  For example I have Bean class User</p>
  
  <pre><code>class User {
      private String firstName;
      private String lastName;
      private String companyName;
      //Getters and Setters
  }
  </code></pre>
  
  <p>I have stored three records of this in table. like 
   (FIRST_NAME , LAST_NAME , COMPANY_NAME)
   (John,Woods,Persistent) (Bill,Gates,Microsoft) (Steve,Jobs,Apple)</p>
  
  <p>And when I am getting these records from table it's in a list like this</p>
  
  <pre><code>List&lt;T&gt; list = query.getResultList();
  </code></pre>
  
  <p>Now I want to check if any user has lastName = Jobs then change the value of Company to Google.</p>
  
  <p>Someone please tell me how should I do this.</p>