code: public static <T> List<T> getListIfIsPresent(Optional<T>... optionals) {
          return Arrays.stream(optionals).filter(Optional::isPresent)
                  .map(Optional::get).collect(Collectors.toList());
      }
docs: Gets list if is present.
  
  @param <T>       the type parameter
  @param optionals the optionals
  @return the list if is present