高于 Integer.MAX_VALUE 的地图条目

Map entries higher than Integer.MAX_VALUE

我正在处理非常大的小对象集合。我正在使用 ChronicleMap,效果非常好。

地图条目的最大数量是否限制为Integer.MAX_VALUE

如果不是,如果条目数大于Integer.MAX_VALUE,我如何获得地图的实际大小作为map.size() returns Integer.MAX_VALUE

提前致谢。

ChronicleMap 大小不限于传统地图 integer.MAX_VALUE。要获取大小,您可以使用 longSize() 其中 return 长值

您可以使用ChronicleMap.longSize instead to get the size as a long. ChronicleMap.size will return Integer.MAX_VALUE when the size is greater then Integer.MAX_VALUE per the source: https://github.com/OpenHFT/Chronicle-Map/blob/master/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java#L707

这是按照Collection.size接口:

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.