Checking if Collection contains an Object inside an Object
<pre><code>public class Address{
 private TypeAddress typeAddress;
 private String street;
 //Getters and Setters
 ...
}

public class TypeAddress{
  private String type;
  //Getters and Setters
  ...
}
</code></pre>

<p>I have a Collection of Addresses </p>

<pre><code>Collection&lt;Address&gt; addresses = db.getAddresses();
</code></pre>

<p>I need to check if is there any address of a type that the costumer will pick.
It's just pretending a situation so you guys will understand.</p>

<p>What I want is, I want to get the address of just one type, that type that the customer picked up. If he picked a type that does not exist, I'll pick another address.
So, I basically need to do 2 loops to check if is there any of its type, and if there is, I'll pick it on the next loop. If it's not, I'll pick another one on the next loop.
Is there a way to use the contains method of a Collection to check if the type of the address is what I want?</p>

<p>Something like:</p>

<pre><code>if(addresses.contains("someType")){//remind that I'm trying to check not the object Address, but the object TypeAddress
 //get this address
}else{
 //get another address
}
</code></pre>
