class Response {
    
    private final int status;
    private final String text;
    private final Map<String, List<String>> headers;

    public Response(int status, String text, Map<String, List<String>> headers) {
        this.status  = status;
        this.text    = requireNonNull(text);
        this.headers = requireNonNull(headers);
    }

    public int getStatus() {
        return status;
    }

    public String getText() {
        return text;
    }

    public Map<String, List<String>> getHeaders() {
        return headers;
    }
    
    public boolean success() {
        switch (status) {
            case 200: case 201: case 202: case 203:
            case 204: case 205: case 206: return true;
            default: return false;
        }
    }
    
    public Optional<Object> decodeJson() {<FILL_FUNCTION_BODY>}
    
    public Stream<Object> decodeJsonArray() {
        @SuppressWarnings("unchecked")
        final Collection<Object> results = (Collection<Object>) Json.fromJson(text);
        return results.stream();
    }
}

        if (!success()) {
            return Optional.empty();
        } else {
            return Optional.ofNullable(Json.fromJson(text));
        }
    
<no_super_class>