nfsantos commented on code in PR #3149:
URL: https://github.com/apache/jackrabbit-oak/pull/3149#discussion_r4106335363


##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/DefaultSegmentWriter.java:
##########
@@ -452,12 +451,15 @@ private RecordId writeList(@NotNull List<RecordId> list) 
throws IOException {
             checkArgument(!list.isEmpty());
             List<RecordId> thisLevel = list;
             while (thisLevel.size() > 1) {
-                List<RecordId> nextLevel = new ArrayList<>();
-                for (List<RecordId> bucket : 
ListUtils.partitionList(thisLevel, ListRecord.LEVEL_SIZE)) {
-                    if (bucket.size() > 1) {
-                        nextLevel.add(writeListBucket(bucket));
+                int size = thisLevel.size();
+                int levelSize = ListRecord.LEVEL_SIZE;
+                List<RecordId> nextLevel = new ArrayList<>((size + levelSize - 
1) / levelSize);

Review Comment:
   Yes, a bit obscure. :) Added a clarifying comment. 



-- 
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]

Reply via email to