BinaryWriter.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:travny 作者:
private static int sizeOfMap(MapSchema mapSchema, Map value) {
    Set<Map.Entry> entrySet = value.entrySet();
    Iterator<Map.Entry> it = entrySet.iterator();
    int size = CodedOutputStream.computeInt32SizeNoTag(value.size());
    while (it.hasNext()) {
        Map.Entry entry = it.next();
        if (entry.getKey() == null || entry.getValue() == null) {
            continue;
        }
        int keySize = sizeOf(mapSchema.getKeySchema(), entry.getKey());
        if (mapSchema.getKeySchema().getType().isAlwaysSkippable()) {
            keySize += getSkippableIndexOverheadSize(mapSchema.getKeySchema().getType(), keySize);
        }
        int valSize = sizeOf(mapSchema.getValueSchema(), entry.getValue());
        if (mapSchema.getValueSchema().getType().isAlwaysSkippable()) {
            valSize += getSkippableIndexOverheadSize(mapSchema.getValueSchema().getType(), valSize);
        }
        size += keySize + valSize;
    }
    return size;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号