dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Sep 2, 2019

Validate Arguments via Google Guava

Google Guava Preconditions are quite useful for validating arguments of methods. Here it is an example:

public void setAge(int age) {
    Preconditions.checkArgument(assert age = 0, "Age cannot be negative");
    ...
}
Octavia Anghel
 
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date