public static Collection<Bucket> getBuckets(MapWritable key) { Collection<Bucket> bucketList = new ArrayList<Bucket>(); MapWritable bucketMap = (MapWritable) key.get(MAPWRITABLE_BUCKET_KEY); for (Writable w : bucketMap.values()) { bucketList.add((Bucket) w); } return bucketList; }
public MapWritable getBucketAsKey(BucketStripped bucketStripped) throws IOException { MapWritable mw = new MapWritable(); MapWritable bucketMap = new MapWritable(); Bucket bucket = getBucket(bucketStripped); bucketMap.put(new IntWritable(bucket.hashCode()), bucket); mw.put(MAPWRITABLE_BUCKET_KEY, bucketMap); return mw; }
public MapWritable toMapWritableKey() { MapWritable mw = new MapWritable(); MapWritable bucketMap = new MapWritable(); for (IntWritable key : bucketCache.keySet()) { bucketMap.put(key, bucketCache.get(key)); } mw.put(MAPWRITABLE_BUCKET_KEY, bucketMap); return mw; }