sort array list of special strings, by date

前端 未结 6 597
有刺的猬
有刺的猬 2021-01-25 10:33

I have an arrayList.

This is an arrayList of strings. The string contains a \"Date.toString\" in format of \"January 1, 1970, 00:00:00 GMT\" +

6条回答
  •  清酒与你
    2021-01-25 10:53

    For each String, convert it to a Date, possibly using a SimpleDateFormat, and put them all in a TreeMap, which will sort them for you.

    Edit: And as @Sean Patrick Floyd suggested, do it on input.

提交回复
热议问题