- Nov 16, 2006
- 557
- 0
- 0
Hey guys,
I need to write a method in Java, that does something similar to SQL's group by.
Here's an example input file:
1, 2, 3, 4
1, 2, 5, 7
1, 2, 5, 8
1, 2, 5, 9
1, 2, 3, 4
And I want to group by column 3,
so my output file should be:
1, 2, 3, 4
1, 2, 3, 4
1, 2, 5, 7
1, 2, 5, 8
1, 2, 5, 9
Whats the best way to do this? Just sort based on values in that column? What if I want to group by more than 1 column?
Thanks for the help in advance!!
I need to write a method in Java, that does something similar to SQL's group by.
Here's an example input file:
1, 2, 3, 4
1, 2, 5, 7
1, 2, 5, 8
1, 2, 5, 9
1, 2, 3, 4
And I want to group by column 3,
so my output file should be:
1, 2, 3, 4
1, 2, 3, 4
1, 2, 5, 7
1, 2, 5, 8
1, 2, 5, 9
Whats the best way to do this? Just sort based on values in that column? What if I want to group by more than 1 column?
Thanks for the help in advance!!
