From 347bcb93542a69f456c4d3d3ed5d15aa0f9027a5 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 28 Dec 2022 17:38:00 +0100 Subject: [PATCH] refactor: Streamlined API of `Chatroom` - all return-types are reactive --- .../java/de/juplo/kafka/chat/backend/domain/Chatroom.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java b/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java index 115dcd69..e1638aa9 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java @@ -10,7 +10,6 @@ import reactor.core.publisher.Sinks; import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Stream; @RequiredArgsConstructor @@ -72,16 +71,16 @@ public class Chatroom return sink.asFlux(); } - public Stream getMessages(long first, long last) + public Flux getMessages(long first, long last) { - return messages + return Flux.fromStream(messages .values() .stream() .filter(message -> { long serial = message.getSerialNumber(); return serial >= first && serial <= last; - }); + })); } -- 2.20.1