sort 1 - sort 2
in
Programming Questions
•
2 years ago
I have a csv file with a lot of lines thich go about the songs of the hot100 since 1890 till now.
What i want is a way to get a sorted array back with the id's of the songs sorted by 2 types.
Like
int[] ids = mySortFunction(sort1, sort 2);
where sort1 can be year for example and sort2 the position it was on in week1 it entered the hot100.
2011 - 6
2011 - 3
2011 - 1
2010 - 8
2010 - 4
2010 - 2
The lines are like this:
I don't need to sort things based on name (like a-z). Just number based.
Getting a part of the line is not the problem, if i use tokens[DATE_ENTERED] then i get the date entered for example (as a string but converting to an int or long is also no problem).
The id is just the number of the line.
i would like the results to be i array with the id's:
id[0] = 10256;
id[1] = 2035;
id[2] = 3450;
But now what?
What i want is a way to get a sorted array back with the id's of the songs sorted by 2 types.
Like
int[] ids = mySortFunction(sort1, sort 2);
where sort1 can be year for example and sort2 the position it was on in week1 it entered the hot100.
2011 - 6
2011 - 3
2011 - 1
2010 - 8
2010 - 4
2010 - 2
The lines are like this:
- 2011~472~h~2011-011~13~0~0~1~53~null~Chris Young~Young, Chris~null~null~The Man I Want To Be~null~Voices~3:06~null~null~null~null~null~null~RCA Nashville Digital~null~null~null~Country~null~C.Young,C.Tompkins,C.Wiseman~382~11-20-2010~02-12-2011~89~91~81~81~77~69~63~80~68~64~60~55~53~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null
- 2011~473~h~2011-012~13~2~0~1~35~null~Jason Aldean~Aldean, Jason~With Kelly Clarkson~null~My Kinda Party~null~Don't You Wanna Stay~4:16~null~null~null~null~null~null~Broken Bow Digital~null~null~null~Country~null~J.Sellers,P.Jenkins,A.Gibson~498~11-20-2010~02-12-2011~93~56~79~95~87~70~60~57~52~49~43~39~35~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null~null
I don't need to sort things based on name (like a-z). Just number based.
Getting a part of the line is not the problem, if i use tokens[DATE_ENTERED] then i get the date entered for example (as a string but converting to an int or long is also no problem).
The id is just the number of the line.
i would like the results to be i array with the id's:
id[0] = 10256;
id[1] = 2035;
id[2] = 3450;
But now what?
1