【发布时间】:2015-08-12 10:12:37
【问题描述】:
来自番石榴不可变表的派生视图是否在原始提供的表中保留插入顺序?
例如,考虑下面的“原始提供的表格”。
ImmutableTable<String, String, String> table = ImmutableTable.<String, String, String>builder()
.put("r1", "c1", "v1")
.put("r2", "c1", "v2")
.put("r3", "c1", "v3")
.put("r4", "c2", "v4")
.build();
现在如果我操作
table.column("c1").entrySet().iterator()
迭代是否会按照“原始提供的表”的插入顺序提供结果?
注意:根据documentation 对从 ArrayTable 派生的视图的迭代保留原始表中的插入顺序。我的用例更倾向于使用不可变表。
【问题讨论】:
标签: java collections iteration guava