我有一些这样的代码:
Table = ets:new(table, [bag]),
true = ets:insert(Table, {bucket_1, some_value_1}),
true = ets:insert(Table, {bucket_1, some_value_2}),
true = ets:insert(Table, {bucket_1, some_value_3}),
LookupResult = ets:lookup(Table, bucket_1),
?_assertEqual(
[{bucket_1, some_value_1}, {bucket_1, some_value_2}, {bucket_1, some_value_3}],
LookupResult
).
ETS 是否保证存储桶中元素的排序?我是否应该期望 ETS 保存元素的顺序,因为元素已添加到表中?
最佳答案
关于sorting - Erlang ETS 带包类型元素排序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23714387/