What exception to throw when an important parameter/dependency is missing?

Posted by Pentium10 on Stack Overflow See other posts from Stack Overflow or by Pentium10
Published on 2010-03-25T17:36:12Z Indexed on 2010/03/25 17:43 UTC
Read the original article Hit count: 252

Filed under:
|
|

Take this method

public List<String> getGroups() {
    if (this.getId().equals("")) return null;
}

I would like to throw exception instead returning null, what's the exception to throw when an important parameter/dependency has not been set?

© Stack Overflow or respective owner

Related posts about java

Related posts about oop