How can I group values in ArrayList
Let's say I have List<Example> list = new ArrayList<Example>();
and Example is
public class Example{
private Date date;
private Integer no;
private Integer salary;
}
and I have initial data
01.01.2009 , 1 , 10000
02.01.2009, 1, 20000
01.01.2009, 2, 30000
and I want to transform this to two new lists so I can have in the first
arrayList grouped values by distinct date, and third row summed;
01.01.2009, 40000
02.01.2009, 20000
and second list distinct date+no and third row summed;
01.01.2009 , 1, 10000
01.01.2009, 2, 30000
02.01.2009, 1 , 20000
How can i do this transformation ?
Thanks in advance.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4092 (20090520) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com