Replaced null checks with Objects.requireNonNull.