title: How to apply contains function on attribute of a Java Object?
body: <p>I have <code>Address</code> class as:</p>
  
  <pre><code>public class Address{
      private String city;
      private String pincode;
      private String state;
  }
  </code></pre>
  
  <p>I have an attribute of different object <code>request</code> as <code>private List&lt;Address&gt; transitLocations</code>.</p>
  
  <p>How can I check if <code>transitLocations</code> contains an address which is having state equals to <code>"SomeString"</code> in one line.</p>
  
  <p>PS: Please assume all getters &amp; setters are present in code.<br>
  I don't want to override equals because <code>Address</code> class is used at other places too.</p>