code: public static <T> Optional<T> getOptionalIfTrue(boolean bool, T target) {
          return bool ? Optional.ofNullable(target) : Optional.empty();
      }
docs: Gets optional if true.
  
  @param <T>    the type parameter
  @param bool   the bool
  @param target the target
  @return the optional if true