How can I have a list in java with larger than integer space

前端 未结 2 435
失恋的感觉
失恋的感觉 2021-01-24 18:51

I am using java.util.List in java for storing a results of my calculation

How can I store values for indexes bigger than maximum integer? (eg large)

2条回答
  •  一个人的身影
    2021-01-24 19:13

    The FastUtil library, which specializes in huge data structures, has a BigList class whose implementation actually uses arrays of arrays. Getters and setters take long parameters for indices.

    With fastutil 6, a new set of classes makes it possible to handle very large collections: in particular, collections whose size exceeds 2^31. Big arrays are arrays-of-arrays handled by a wealth of static methods that act on them as if they were monodimensional arrays with 64-bit indices, and big lists provide 64-bit list access.

提交回复
热议问题