He-Pin commented on code in PR #543:
URL: https://github.com/apache/pekko-projection/pull/543#discussion_r3480428161


##########
examples/src/test/java/jdocs/guide/EventGeneratorApp.java:
##########
@@ -197,7 +197,7 @@ static class CartPersistentBehavior
     public CartPersistentBehavior(PersistenceId persistenceId, String tag) {
       super(persistenceId);
       this.tag = tag;
-      this.tags = new HashSet<>(Collections.singletonList(tag));
+      this.tags = new HashSet<>(List.of(tag));

Review Comment:
   Yes, Set.of(tag) is correct here — the `tags` field is typed as 
`Set<String>` and was previously assigned via `new 
HashSet<>(Collections.singletonList(tag))`. `Set.of(tag)` produces an immutable 
single-element Set directly, eliminating the intermediate singletonList + 
HashSet wrapping.
   
   Note: the PRODUCTS field (List<String>) retains `List.of(...)` since its 
declared type is List and usage relies on positional access via 
`PRODUCTS.size()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to