public void writePartition(DataOutput out,
int partitionId) throws IOException {
Long2DoubleOpenHashMap partitionMap = map.get(partitionId);
out.writeInt(partitionMap.size());
ObjectIterator<Long2DoubleMap.Entry> iterator =
partitionMap.long2DoubleEntrySet().fastIterator();
while (iterator.hasNext()) {
Long2DoubleMap.Entry entry = iterator.next();
out.writeLong(entry.getLongKey());
out.writeDouble(entry.getDoubleValue());
}