class URL implements Serializable {

    public URL addParameters(Map<String, String> parameters) {
        if (CollectionUtils.isEmptyMap(parameters)) {
            return this;
        }

        boolean hasAndEqual = true;
        for (Map.Entry<String, String> entry : parameters.entrySet()) {
            String value = getParameters().get(entry.getKey());
            if (value == null) {
                if (entry.getValue() != null) {
                    hasAndEqual = false;
                    break;
                }
            } else {
                if (!value.equals(entry.getValue())) {
                    hasAndEqual = false;
                    break;
                }
            }
        }
        // return immediately if there's no change
        if (hasAndEqual) {
            return this;
        }

        Map<String, String> map = new HashMap<>(getParameters());
        map.putAll(parameters);
        return new URL(getProtocol(), username, password, host, port, path, map);
    }

    protected  URL();
    public  URL(String protocol, String host, int port);
    public  URL(String protocol, String host, int port, String[] pairs);
    public  URL(String protocol, String host, int port, Map<String, String> parameters);
    public  URL(String protocol, String host, int port, String path);
    public  URL(String protocol, String host, int port, String path, String... pairs);
    public  URL(String protocol, String host, int port, String path, Map<String, String> parameters);
    public  URL(String protocol, String username, String password, String host, int port, String path);
    public  URL(String protocol, String username, String password, String host, int port, String path, String... pairs);
    public  URL(String protocol,
               String username,
               String password,
               String host,
               int port,
               String path,
               Map<String, String> parameters);
    public  URL(String protocol,
               String username,
               String password,
               String host,
               int port,
               String path,
               Map<String, String> parameters,
               Map<String, Map<String, String>> methodParameters);

}