Hello guys,
I am new to java and have the following output from a sql resultset:
Year: 2002 Total: 1341 Format: PDF
Year: 2002 Total: 77 Format: PALM
Year: 2002 Total: 1 Format: AUDIO
Year: 2003 Total: 6596 Format: PDF
Year: 2003 Total: 381 Format: PALM
Year: 2003 Total: 3 Format: AUDIO
Year: 2003 Total: 53 Format: MSR
Year: 2004 Total: 11380 Format: PDF
Year: 2004 Total: 315 Format: PALM
Year: 2004 Total: 78 Format: MSR
Year: 2005 Total: 13720 Format: PDF
Year: 2005 Total: 288 Format: PALM
Year: 2005 Total: 55 Format: AUDIO
Year: 2005 Total: 153 Format: MSR
Year: 2006 Total: 14136 Format: PDF
Year: 2006 Total: 403 Format: PALM
Year: 2006 Total: 148 Format: AUDIO
Year: 2006 Total: 157 Format: MSR
Year: 2007 Total: 15783 Format: PDF
Year: 2007 Total: 448 Format: PALM
Year: 2007 Total: 87 Format: AUDIO
Year: 2007 Total: 291 Format: MSR
Year: 2007 Total: 27 Format: BLACKBERRY
Year: 2008 Total: 9819 Format: PDF
Year: 2008 Total: 324 Format: PALM
Year: 2008 Total: 64 Format: AUDIO
Year: 2008 Total: 343 Format: MSR
Year: 2008 Total: 75 Format: BLACKBERRY
Year: 2008 Total: 6 Format: HTML MOBILE
Year: 2009 Total: 4662 Format: PDF
Year: 2009 Total: 171 Format: PALM
Year: 2009 Total: 46 Format: AUDIO
Year: 2009 Total: 269 Format: MSR
Year: 2009 Total: 99 Format: BLACKBERRY
Year: 2009 Total: 4 Format: MOBI
Year: 2010 Total: 663 Format: PDF
Year: 2010 Total: 23 Format: PALM
Year: 2010 Total: 36 Format: MSR
Year: 2010 Total: 15 Format: BLACKBERRY
What I would like to achieve is this kind of bag:
Year PDF PALM AUDIO MSR ... ...
2002 1341 77 1 n/a
2003 6596 381 3 53 ... ...
and so on. I was thinking about ArrayList and HashMap to solve the issue, but don't see exactly where to start from.
I am new to java and have the following output from a sql resultset:
Year: 2002 Total: 1341 Format: PDF
Year: 2002 Total: 77 Format: PALM
Year: 2002 Total: 1 Format: AUDIO
Year: 2003 Total: 6596 Format: PDF
Year: 2003 Total: 381 Format: PALM
Year: 2003 Total: 3 Format: AUDIO
Year: 2003 Total: 53 Format: MSR
Year: 2004 Total: 11380 Format: PDF
Year: 2004 Total: 315 Format: PALM
Year: 2004 Total: 78 Format: MSR
Year: 2005 Total: 13720 Format: PDF
Year: 2005 Total: 288 Format: PALM
Year: 2005 Total: 55 Format: AUDIO
Year: 2005 Total: 153 Format: MSR
Year: 2006 Total: 14136 Format: PDF
Year: 2006 Total: 403 Format: PALM
Year: 2006 Total: 148 Format: AUDIO
Year: 2006 Total: 157 Format: MSR
Year: 2007 Total: 15783 Format: PDF
Year: 2007 Total: 448 Format: PALM
Year: 2007 Total: 87 Format: AUDIO
Year: 2007 Total: 291 Format: MSR
Year: 2007 Total: 27 Format: BLACKBERRY
Year: 2008 Total: 9819 Format: PDF
Year: 2008 Total: 324 Format: PALM
Year: 2008 Total: 64 Format: AUDIO
Year: 2008 Total: 343 Format: MSR
Year: 2008 Total: 75 Format: BLACKBERRY
Year: 2008 Total: 6 Format: HTML MOBILE
Year: 2009 Total: 4662 Format: PDF
Year: 2009 Total: 171 Format: PALM
Year: 2009 Total: 46 Format: AUDIO
Year: 2009 Total: 269 Format: MSR
Year: 2009 Total: 99 Format: BLACKBERRY
Year: 2009 Total: 4 Format: MOBI
Year: 2010 Total: 663 Format: PDF
Year: 2010 Total: 23 Format: PALM
Year: 2010 Total: 36 Format: MSR
Year: 2010 Total: 15 Format: BLACKBERRY
What I would like to achieve is this kind of bag:
Year PDF PALM AUDIO MSR ... ...
2002 1341 77 1 n/a
2003 6596 381 3 53 ... ...
and so on. I was thinking about ArrayList and HashMap to solve the issue, but don't see exactly where to start from.