@Override
    protected void writeValue(final BulkSet value, final Buffer buffer, final GraphBinaryWriter context) throws IOException {
        final Map<Object,Long> raw = value.asBulk();
        buffer.writeInt(raw.size());

        for (Object key : raw.keySet()) {
            context.write(key, buffer);
            buffer.writeLong(value.get(key));
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/BulkSetSerializer.java