Hi All,
 I am using Hadoop 0.20.2 . I am observing a Strange behavior of Java
Collection's . I have following code in reducer

       public void reduce(Text text, Iterator<Text> values,
            OutputCollector<Text, Text> collector, Reporter reporter)
throws IOException {
        // TODO Auto-generated method stub
        List<Text> list = new ArrayList<Text>();
        while(values.hasNext())
        {
            Text value = values.next();
            list.add(value);
            System.out.println(value.toString());       }

        for(Text value : list)
        {
            System.out.println(value.toString());
        }

    }

The  first sysout prints following

4       5       6

1       2       3

But when I print from the List, it prints following

1       2       3
1       2       3

*
*The all List values are getting replaced by last added value.

I am not able to understand this behavior. Did anyone seen this behavior ?

Regards,
Madhukara Phatak

-- 
https://github.com/zinnia-phatak-dev/Nectar

Reply via email to