Join: Use Precondition#checkNotNull everywhere
@@ -42,7 +42,7 @@ public abstract class Join<T> extends Condition<T> {
*/
@SafeVarargs
protected Join(Condition<? super T>... conditions) {
- if (conditions == null) throw conditionsIsNull();
+ checkNotNull(conditions, conditionsIsNull());
this.conditions = Arrays.stream(conditions).map(Join::notNull).collect(toList());
}
@@ -53,14 +53,14 @@ public abstract class Join<T> extends Condition<T> {
* @throws NullPointerException if any of the elements in the given iterable is {@code null}.
*/
protected Join(Iterable<? extends Condition<? super T>> conditions) {
- if (conditions == null) throw conditionsIsNull();
+ checkNotNull(conditions, conditionsIsNull());
this.conditions = new ArrayList<>();
for (Condition<? super T> condition : conditions)
this.conditions.add(notNull(condition));
}
- private static NullPointerException conditionsIsNull() {
- return new NullPointerException("The given conditions should not be null");
+ private static String conditionsIsNull() {
+ return "The given conditions should not be null";
}
private static <T> Condition<T> notNull(Condition<T> condition) {
