I have List contains several Timestamp.toDate() like following
List MyList= [
2022-06-09 10:01:56.874
2022-06-09 11:02:22.874 // it has the same previous days,months but difference times
2022-06-09 12:03:22.874 // it has the same previous days,months but difference times too
2023-06-09 11:00:56.874 // it has the same previous days,months but difference Years
]
Now, how can I remove all elements that has the same days,months with keeping one old element of these days at least (the selected element will be the oldest time )
and the same with years
so I want the output like following
List MyList= [
2022-06-09 10:01:56.874 // i will keep this element because it is old one
2022-06-09 11:02:22.874 // i will delete this because it has same previous day and month
2022-06-09 12:03:22.874 // i will delete this because it has same previous day and month too
2023-06-09 11:00:56.874 // we have here same previous days and month but i will keep it because it has difference year
]
SO the Final
List MyList= [
2022-06-09 10:01:56.874
2023-06-09 11:00:56.874
]
I have big List with Big elements like this any one could tell me how to filter my list like this ? thanks