MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / calculateCapacity

Method calculateCapacity

Ports/CLDC11/src/java/util/HashMap.java:284–298  ·  view source on GitHub ↗
(int x)

Source from the content-addressed store, hash-verified

282 ///
283 /// storage size
284 private static final int calculateCapacity(int x) {
285 if(x >= 1 << 30){
286 return 1 << 30;
287 }
288 if(x == 0){
289 return 16;
290 }
291 x = x -1;
292 x |= x >> 1;
293 x |= x >> 2;
294 x |= x >> 4;
295 x |= x >> 8;
296 x |= x >> 16;
297 return x + 1;
298 }
299
300 /// Constructs a new `HashMap` instance with the specified capacity and
301 /// load factor.

Callers 2

HashMapMethod · 0.95
rehashMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected