private IndexToIndexMultiMap build() throws IOException {
final TreeMultimap<Integer, Integer> elements = TreeMultimap.create();
for (int i = 0; i < VALUES; i++) {
elements.put(i / 2, i);
}
final com.yandex.yoctodb.util.mutable.IndexToIndexMultiMap mutable =
new com.yandex.yoctodb.util.mutable.impl.IntIndexToIndexMultiMap(
elements.asMap().values());
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
mutable.writeTo(baos);
final Buffer buf = Buffer.from(baos.toByteArray());
assertEquals(
V1DatabaseFormat.MultiMapType.LIST_BASED.getCode(),
buf.getInt());
final IndexToIndexMultiMap result =
IntIndexToIndexMultiMap.from(buf);
assertEquals(VALUES / 2, result.getKeysCount());
return result;
}
IntIndexToIndexMultiMapTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:yoctodb
作者:
评论列表
文章目录