Dhruv,
If the <Writable, Writable> are IntWritable and DoubleWritable
underneath, simply cast them properly to those types after
get{Key,Value}() and then use the appropriate method to get the
underlying value (Simple .get() in most cases).
Is this what you're looking for?
On Wed, Jun 22, 2011 at 1:44 AM, Dhruv Kumar <[email protected]> wrote:
> I want to extract the key-value pairs from a MapWritable, cast them into
> Integer (key) and Double (value) types, and add them to another collection.
> I'm attempting the following but this code is incorrect.
>
> // initialDistributionStripe is a MapWritable<IntWritable, DoubleWritable>
> // initialProbabilities is of type Vector which can have (Integer, Double)
> entries in it
>
> for (Map.Entry<Writable, Writable> entry : initialDistributionStripe.
> entrySet()) {
> initialProbabilities.set(entry.getKey(), entry.getValue());
> }
>
>
> Is there a convenient way to do this?
>
--
Harsh J