hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oo famcr <famc...@gmail.com>
Subject Re: How to use LinkedList in Hadoop?
Date Wed, 23 Dec 2009 15:11:04 GMT
i think it's local var.
The codes below is changed little from wordcount.

On Wednesday, December 23, 2009, Jeff Zhang <zjffdu@gmail.com> wrote:
> What is the activeList ? a local variable or class member variable?
>
>
> On Wed, Dec 23, 2009 at 6:30 AM, oo famcr <famcroo@gmail.com> wrote:
>
>> Hello everyone
>> I want to save the value to a LinkedList, but THE ***activeList.get(0)***
>> have been changed every time.
>> I think it should be the first element, but it's not.
>>
>> Thanks
>> Song
>>
>> ==========Part of WordCount===========
>>  public static class IntSumReducer
>>       extends Reducer<Text,Text,Text,Text> {
>>    private List<Text> activeList = new LinkedList<Text>();
>>    public void reduce(Text key, Iterable<Text> values,
>>                       Context context
>>                       ) throws IOException, InterruptedException {
>>      for (Text val : values) {
>>        activeList.add(val);
>>        context.write(key, new Text(  activeList.get(0).toString()  ));
>>      }
>>    }
>>
>

Mime
View raw message