arve
04/29/2017, 5:34 PMMyClass(groupId, datetime, someValue)
Next, I have a Set<MyClass>
, which can contain multiple entries with the same groupId. I want to turn this into a Set<MyClass>
that contains the latest(by datetime) entry for each groupId. What’s a good functional/stream-like way of achieving this?Andreas Sinz
04/29/2017, 5:41 PMSet<MyClass>.groupBy { it.datetime }.map { it.value[0] }