DATAMONGO-2570 - Polishing.

Add assertions. Use method references where possible.

Original pull request: #871.
This commit is contained in:
Mark Paluch
2020-06-22 10:38:54 +02:00
parent b0814d334f
commit 26e8b3a8ec

View File

@@ -95,7 +95,7 @@ public class SimpleMongoRepository<T, ID> implements MongoRepository<T, ID> {
Assert.notNull(entities, "The given Iterable of entities not be null!");
Streamable<S> source = Streamable.of(entities);
boolean allNew = source.stream().allMatch(it -> entityInformation.isNew(it));
boolean allNew = source.stream().allMatch(entityInformation::isNew);
if (allNew) {
@@ -202,6 +202,8 @@ public class SimpleMongoRepository<T, ID> implements MongoRepository<T, ID> {
@Override
public Iterable<T> findAllById(Iterable<ID> ids) {
Assert.notNull(ids, "The given Ids of entities not be null!");
return findAll(new Query(new Criteria(entityInformation.getIdAttribute())
.in(Streamable.of(ids).stream().collect(StreamUtils.toUnmodifiableList()))));
}