I have an ArrayList<String>
. The entries in the list can be of the following form:
42356_11_1_9345668
562834_12_1_8674852_8
52423_4_2_586284_2
5234_13_9_535567
As you can see the middle part contains the date: xx_y is the day and the month. The other values to the left and right can be of arbitray length. Some Strings have one last additional digit.
I would like to sort the list first according to month (y in xx_y) and then according to day (xx in xx_y). Of course it is possible that the month and day are equal. In this case it should additionally be sorted according to the number following the month (e.g. 8674852 in the second example).
How can this be done? If it is easier with other data structures, this is ok, I'm flexible.