Skip to main content
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

nvseenu's answernvseenu's answer is good but I like varargs. In your getParameter method

{
    String user = .... // all the parameters
    .
    .
    .
    // then
    validate(user, pwd, ...) // and all this may look big but with auto-completion 
                             // it's not a big headache
}

private void validate(String... parameters) {
    for(String parameter : parameters) {
        if(parameter == null || "".equals(parameter)) {
            System.exit(0); // but it's bad IMO
        }
    }
    return;
}

nvseenu's answer is good but I like varargs. In your getParameter method

{
    String user = .... // all the parameters
    .
    .
    .
    // then
    validate(user, pwd, ...) // and all this may look big but with auto-completion 
                             // it's not a big headache
}

private void validate(String... parameters) {
    for(String parameter : parameters) {
        if(parameter == null || "".equals(parameter)) {
            System.exit(0); // but it's bad IMO
        }
    }
    return;
}

nvseenu's answer is good but I like varargs. In your getParameter method

{
    String user = .... // all the parameters
    .
    .
    .
    // then
    validate(user, pwd, ...) // and all this may look big but with auto-completion 
                             // it's not a big headache
}

private void validate(String... parameters) {
    for(String parameter : parameters) {
        if(parameter == null || "".equals(parameter)) {
            System.exit(0); // but it's bad IMO
        }
    }
    return;
}
Source Link

nvseenu's answer is good but I like varargs. In your getParameter method

{
    String user = .... // all the parameters
    .
    .
    .
    // then
    validate(user, pwd, ...) // and all this may look big but with auto-completion 
                             // it's not a big headache
}

private void validate(String... parameters) {
    for(String parameter : parameters) {
        if(parameter == null || "".equals(parameter)) {
            System.exit(0); // but it's bad IMO
        }
    }
    return;
}