[英]Java Array of Linked Lists
I am trying to code a custom hashtable which can allows multiple values. 我正在尝试编写一个自定义哈希表,它可以允许多个值。
We are doing it in following way: 我们是按照以下方式进行的:
Means structure like: 手段结构如:
value1 -> value6
NULL
Null
value3 -> value7
Null
...
...(until Int-Max)
Now, as we will store nearly 500 millions of key value pairs, at-lest 1600 millions link lists are going to be wasted. 现在,由于我们将存储近5亿个关键值对,因此将浪费1600万个链接列表。
Now, as per suggestion fro my working place, I am trying to build hashtable with structure like: 现在,根据我的工作场所的建议,我正在尝试使用以下结构构建哈希表:
1 -> value1 -> value6
0
0
1 -> value3 -> value7 // here 0/1 bit defines linked lists exits or not
0
...
...(until Int-Max)
Can anybody help me is this possible to build such kind of structure ? 任何人都可以帮助我建立这样的结构吗?
Edit: 编辑:
You can not create an array of generic type because array is reified type. 您无法创建泛型类型的数组,因为数组是reified类型。 Generics are implemented by erasure.
泛型通过擦除实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.