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 aa2716c2c0
commit 171386baaf

View File

@@ -98,7 +98,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) {
@@ -212,6 +212,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()))));
}