code: public static <K, T extends V, V> KeyValue<K, V> from(K key, Optional<T> optional) {
  
          LettuceAssert.notNull(optional, "Optional must not be null");
  
          if (optional.isPresent()) {
              return new KeyValue<K, V>(key, optional.get());
          }
  
          return empty(key);
      }
docs: Creates a {@link KeyValue} from a {@code key} and an {@link Optional}. The resulting value contains the value from the
  {@link Optional} if a value is present. Value is empty if the {@link Optional} is empty.
  
  @param key the key, must not be {@literal null}.
  @param optional the optional. May be empty but never {@literal null}.
  @param <K>
  @param <T>
  @param <V>
  @return the {@link KeyValue}