static List<String> toSetCookieHeaders(boolean strict, Iterable<? extends Cookie> cookies) {
        if (cookies instanceof Collection) {
            @SuppressWarnings("unchecked")
            final Collection<? extends Cookie> cast = (Collection<? extends Cookie>) cookies;
            return toSetCookieHeaders(strict, cast);
        }

        requireNonNull(cookies, "cookies");
        final Iterator<? extends Cookie> it = cookies.iterator();
        if (!it.hasNext()) {
            return ImmutableList.of();
        }

        final ImmutableList.Builder<String> encoded = ImmutableList.builder();
        return CookieUtil.toSetCookieHeaders(encoded, strict, it);
    }
Encodes the specified {@link Cookie}s into {@code "Set-Cookie"} header values.

@param strict whether to validate that the cookie names and values are in the valid scope
              defined in RFC 6265.
@param cookies the {@link Cookie}s to encode.
@return the encoded {@code "Set-Cookie"} header values.
core/src/main/java/com/linecorp/armeria/common/Cookie.java