class ItemMapper {

    public Map<PrimaryKey, Item> mergeItems(List<ByteBuffer> list) {
        return  list.stream()
                .map( r -> new AbstractMap.SimpleEntry<>(
                                key(r),
                                fromByteBuffer(r)
                        )
                ).collect(
                        Collectors.toMap(
                                AbstractMap.SimpleEntry::getKey,
                                AbstractMap.SimpleEntry::getValue,
                                (left,right) -> mergeItem(
                                        primaryKey(left),
                                        left,
                                        right
                                )
                        )
                );
    }

}