rishabhdaim commented on code in PR #1713:
URL: https://github.com/apache/jackrabbit-oak/pull/1713#discussion_r1762368887


##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java:
##########
@@ -34,6 +36,8 @@
  */
 public class CollectionUtils {
 
+    private static final int MAX_CAPACITY = 1 << 30;

Review Comment:
   This is the maximum capacity of `hashmap`. Any value above this would be 
reverted to this value.
   
   Also, we might hit negative values if we don't specify an upper limit.
   
   See test below:
   
   `@Test
       public void ensureCapacityWithMaxValue() {
           int capacity = CollectionUtils.ensureCapacity(1908874369);
       }`
   
   it returns `-2147483648`, which is wrong.
   



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