package guava.demo.preconditions;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull; (1)
import static com.google.common.base.Preconditions.checkArgument;
public class School {
private final String name;
private final List<String> departments;
/**
* @param name The school name, not null or empty
* @param departments The list of departments at the school, not null or empty
*/
public School(final String name, final List<String> departments) {
checkNotNull(name, "Invalid name provided");
checkArgument(!name.isEmpty(), "The provided name cannot be empty");
checkNotNull(departments, "Invalid department list provided");
checkArgument(!departments.isEmpty(), "The provided department list cannot be empty");
this.name = name;
this.departments = departments;
}
}