title: NULL safe object checking in JAVA 8 using ifPresent
body: <p>I have this function:</p>
  
  <pre><code>public static long toEpochMilli(OffsetDateTime dateTime) {
      return dateTime.toInstant().toEpochMilli();
  }
  </code></pre>
  
  <p>that I want to use but I have to check before if it is null</p>
  
  <pre><code>private Long buildBookingValidDate (TimeIntervalType validFor) {
  
          return Optional.ofNullable(validFor.getStartTimeStamp())
                  .ifPresent(DateUtils::toEpochMilli);
  
      }
  </code></pre>
  
  <p>but I don't know how to return the value</p>