myData{
itemId,
location,
ExpDtTm,
userId
}
I trying to sort a TreeSet like so:
TreeSet<myData> sorted = new TreeSet<>(Comparator.comparing(myData -> myData.ExpDtTm));
But there is a problem if any of the dates are equivalent they wont be added to the tree set which proves to be a problem. If anyone knows what to do help is much appreciated.
I also tried
TreeSet<myData> sorted = new TreeSet<>(Comparator.comparing(myData -> myData.ExpDtTm).thencomparing(myData -> myData.itemId));
But it stopped excepting myData in both of the lambdas.