code: public static <T, R> R firstNonNull(Function<T, R> function, Stream<T> values) {
          return values
                  .map(function)
                  .filter(Objects::nonNull)
                  .findFirst()
                  .orElse(null);
      }
docs: Gets first element which is not null.
  
  @param <T>      type of values.
  @param <R>      element to return.
  @param function function to apply to each value.
  @param values   all possible values.
  @return first result value which was not null, OR <code>null</code> if all values were <code>null</code>.