code: public <T> Optional<T> as(Class<T> type) {
          return inner.filter(d -> d.is(type)).map(d -> d.as(type));
      }
docs: Returns inner value as optional of input type, if the inner value is absent or not an instance of the input
  type an empty optional is returned
  @param type cast type
  @param <T> cast type
  @return inner value as optional of input type