Skip to content

Commit

Permalink
Eliminate Stream in #wrapInCommonSet
Browse files Browse the repository at this point in the history
Elminate Stream creation in SerializationModelCreator#wrapInCommonSet
as it was showing in during profiling.

Signed-off-by: Philippe Marschall <philippe.marschall@gmail.com>
  • Loading branch information
marschall authored and Verdent committed Oct 12, 2023
1 parent ef9ee09 commit db56a3b
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;

import jakarta.json.bind.JsonbException;

Expand Down Expand Up @@ -73,11 +72,8 @@ public SerializationModelCreator(JsonbContext jsonbContext) {
public static ModelSerializer wrapInCommonSet(ModelSerializer modelSerializer,
Customization customization,
JsonbContext jsonbContext) {
return Stream.of(modelSerializer)
.map(KeyWriter::new)
.map(serializer -> new NullSerializer(serializer, customization, jsonbContext))
.findFirst()
.get();
KeyWriter serializer = new KeyWriter(modelSerializer);
return new NullSerializer(serializer, customization, jsonbContext);
}

/**
Expand Down

0 comments on commit db56a3b

Please sign in to comment.