title: Find specific object in a List by attribute
body: <p>I have a list:</p>
  
  <pre><code>List&lt;UserItem&gt; userList = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>Where I add the following:</p>
  
  <pre><code>User father = new User();
  father.setName("Peter");
  
  UserItem parent = new UserItem(father, null);
  userList.add(parent);
  </code></pre>
  
  <p>I then create another user:</p>
  
  <pre><code>User daughter = new User();
  daughter.setName("Emma");
  
  UserItem child = new UserItem(daughter, &lt;OBJECT IN LIST WHERE NAME IS "PETER"&gt;);
  userList.add(child);
  </code></pre>
  
  <p>However, I need to change the text wrapped in <code>&lt;&gt;</code> above to the parent object I added before (the father), specified by the name ("Peter" in this case).</p>
  
  <p><strong>How can I find an object in a List by a specific attribute?</strong> In my case, how can I find the object in the List that has the name "Peter"?</p>
  
  <p>Please note that I add hundreds, sometimes thousands, of different users like this to the list. Each "parent" has a unique name.</p>