[英]Map entries higher than Integer.MAX_VALUE
I am working with very large collections of small objects. 我正在处理大量小物件。 I am using using
ChronicleMap
which is performing very well. 我正在使用性能很好的
ChronicleMap
。
Is the maximum number of map entries limited to Integer.MAX_VALUE
? 映射条目的最大数量是否限制为
Integer.MAX_VALUE
?
If not, how do I get the real size of a map as the map.size()
returns Integer.MAX_VALUE
if the number of entries is higher than Integer.MAX_VALUE
? 如果没有,我如何获取地图的实际尺寸为
map.size()
返回Integer.MAX_VALUE
,如果条目的数量高于Integer.MAX_VALUE
?
Thanks in advance. 提前致谢。
You can use ChronicleMap.longSize
instead to get the size as a long
. 您可以改用
ChronicleMap.longSize
来获取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 ChronicleMap.size
将返回Integer.MAX_VALUE
当尺寸大于Integer.MAX_VALUE
每来源: https://github.com/OpenHFT/Chronicle-Map/blob/master/src/main/java/net/openhft/chronicle /hash/impl/VanillaChronicleHash.java#L707
This is in accordance with the Collection.size
interface: 这符合
Collection.size
接口:
Returns the number of elements in this collection.
返回此集合中的元素数。 If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
如果此集合包含多个Integer.MAX_VALUE元素,则返回Integer.MAX_VALUE。
ChronicleMap size isn't limited to integer.MAX_VALUE as traditional map. ChronicleMap的大小不限于integer.MAX_VALUE作为传统地图。 To get the size, you can use
longSize()
which return a long value 要获取大小,可以使用
longSize()
返回长值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.