Passing a List as output of reducer in Java

Hi,

I am trying to write the find anagram program in java(Which is present in python in material)…But I am unable to pass the arrayList to output. Could you suggest how to do it. Please find my reducer code.

public class AnagramReducer extends Reducer<Text,Text,LongWritable,ArrayWritable>{

public void reduce(Text key,Iterable<Text> value,Context context) throws IOException, InterruptedException
{
	int sum=0;
	List<Text> s=new ArrayList<Text>();
	ArrayWritable aw = new ArrayWritable(Text.class);
	int size=0;
	for(Text text:value)
	{
		size++;
	}
	Text[] t = new Text[size+1];
	for(Text text:value)
	{
		if(!s.contains(text))
		{
			s.add(text);
			t[sum]=text;
			sum++;
		}
		
		
	}
	if(sum>1)
	{
		aw.set(t);
		context.write(new LongWritable(sum), aw );
	}
}

}

@abhinavsingh…Kindly clear my doubt as I am stuck.