You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/12/16 15:42:50 UTC

[GitHub] [jackrabbit-oak] jelmini commented on a change in pull request #442: OAK-9644: Flaky test due to HashSet

jelmini commented on a change in pull request #442:
URL: https://github.com/apache/jackrabbit-oak/pull/442#discussion_r770659776



##########
File path: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterView.java
##########
@@ -187,22 +187,13 @@ private String asJson(final long viewSeqNum, final boolean viewFinal, final Stri
         builder.key("id").value(clusterId);
         builder.key("me").value(localId);
         builder.key("active").array();
-        for (Iterator<Integer> it = activeIds.iterator(); it.hasNext();) {

Review comment:
       A potential alternative:
   `activeIds.stream().sorted().forEachOrdered(builder::value);`
   The `sorted()` operator achieves the same than the `TreeSet`. 
   Usually, `forEach()` and `forEachOrdered()` should have the same behaviour with a sequential stream, but in theory `forEach()` behaviour  is undefined, because in case of a parallel stream it could apply items in any order.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org