GH-69 - Switch to Stream.toList().
This commit is contained in:
@@ -23,7 +23,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
@@ -165,7 +164,7 @@ public class PersistentApplicationEventMulticaster extends AbstractApplicationEv
|
||||
.filter(TransactionalApplicationListener.class::isInstance)
|
||||
.map(TransactionalApplicationListener.class::cast)
|
||||
.sorted(AnnotationAwareOrderComparator.INSTANCE)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private TransactionalEventListeners(
|
||||
@@ -185,7 +184,7 @@ public class PersistentApplicationEventMulticaster extends AbstractApplicationEv
|
||||
|
||||
List<TransactionalApplicationListener<ApplicationEvent>> collect = listeners.stream()
|
||||
.filter(it -> it.getTransactionPhase().equals(phase))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
return new TransactionalEventListeners(collect);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
@@ -85,16 +84,15 @@ class MongoDbEventPublicationRepository implements EventPublicationRepository {
|
||||
var query = query(where("completionDate").isNull());
|
||||
|
||||
return mongoTemplate.find(query, MongoDbEventPublication.class).stream() //
|
||||
.map(this::documentToDomain) //
|
||||
.collect(Collectors.toList());
|
||||
.<EventPublication> map(this::documentToDomain) //
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<EventPublication> findIncompletePublicationsByEventAndTargetIdentifier(
|
||||
Object event, PublicationTargetIdentifier targetIdentifier) {
|
||||
|
||||
var documents = findDocumentsByEventAndTargetIdentifierAndCompletionDateNull( //
|
||||
event, targetIdentifier);
|
||||
var documents = findDocumentsByEventAndTargetIdentifierAndCompletionDateNull(event, targetIdentifier);
|
||||
var results = documents
|
||||
.stream() //
|
||||
.map(this::documentToDomain) //
|
||||
@@ -113,7 +111,8 @@ class MongoDbEventPublicationRepository implements EventPublicationRepository {
|
||||
Object event, PublicationTargetIdentifier targetIdentifier) {
|
||||
|
||||
// we need to enforce writing of the type information
|
||||
var eventAsMongoType = mongoTemplate.getConverter().convertToMongoType(event, TypeInformation.of(Object.class));
|
||||
var eventAsMongoType = mongoTemplate.getConverter().convertToMongoType(event, TypeInformation.OBJECT);
|
||||
|
||||
var query = query(
|
||||
where("event").is(eventAsMongoType) //
|
||||
.and("listenerId").is(targetIdentifier.getValue()) //
|
||||
|
||||
Reference in New Issue
Block a user