Skip to content

Commit

Permalink
Use Optional#map
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureAaron committed Sep 20, 2024
1 parent 7fa219a commit f391165
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void sendMessage(Service service, Message<? extends Message<?>> me
* Useful for sending simple state updates with an optional message
*/
static void sendSimple(Type type, Service service, String serverId, Optional<Message<? extends Message<?>>> message) {
send(type, service, serverId, message.isPresent() ? Optional.of(encodeMessage(message.get())) : Optional.empty());
send(type, service, serverId, message.map(WsMessageHandler::encodeMessage));
}

private static void send(Type type, Service service, String serverId, Optional<Dynamic<?>> message) {
Expand Down

0 comments on commit f391165

Please sign in to comment.