title: How to get the filled field of java.util.Set <Object> or if the field is empty, return something else?
body: <p>I have an Addresses class that is used in two attributes of the Customer class, the first attribute is a simple object to represent the customer's default address and another attribute is a Set &lt;&gt; of addresses that the customer can have.</p>
  <p>I need to send the postalCode field to another class. I would like to check in Set &lt;&gt; if there is a filled postalCode, if yes, send this value, otherwise (if there is no filled postalCode within Set &lt;&gt;) then I should send the postalCode value from the default address. How to do this? I tried this way before:</p>
  <pre><code>Optional.ofNullable(Stream.of(product.getCustomer().getAddresses()).forEach
  (i -&gt; i.getPostalCode())).orElse(product.getCustomer().getAddressDefault().getPostalCode()))
  </code></pre>
  <p>My classes bellow:</p>
  <pre><code>public class Customer {
  
      private Addresses addressDefault;
  
      private Set&lt;Addresses&gt; addresses;
  }
  
  public class Addresses {
  
      private String postalCode;
  
      private String city;
  
      private String state;
  
      private String country;
  
  }
  </code></pre>