can anybody help me finding error in following code. I need to store values in arraylist and then use it for further processing but this code read one value, print it and store in arraylist and then again print it according to my second print statement in loop of arraylist. But i want to store all elements in arraylist and then want to print it. Please help!! Thanks
public class tempreducer extends Reducer<LongWritable,Text,IntWritable,Text> {
public void reduce(LongWritable key, Iterable<Text> values,
Context context) throws IOException, InterruptedException {
System.out.println("reducer");
ArrayList<String> vArrayList = new ArrayList<String>();
for(Text v: values)
{
String line=v.toString();
System.out.println(line);
vArrayList.add(line);
}
for(int i = 0; i < vArrayList.size(); ++i)
{
System.out.println("value"+vArrayList.get(i));
}