android - Compare dates using comparator in Java -
i compare date times in such way end result values have been sorted in date ascending , time descending order. how achieve in java using joda-time library?
data:
01/31 5:50 01/31 5:40 01/30 2:20
result
01/31 5:40 01/31 5:50 01/30 2:20
a simple treeset
(assuming have distinct dates) using comparator comparing datetime.getmillis()
of each date instance trick.
and better, why not use directly "out-of-the-box" comparator ;)
implement exact logic want. (ascendant, descendant, whatever)
Comments
Post a Comment