I have a list like
List<Event>
where Event has properties like eventId, eventName, groupId etc. There can be multiple events belonging to same group. I want a map like
Map<Long, Event>
where key is the groupId and Event is the one which has max eventId. So, basically I just want to sort list of events belonging to same group and then find out the one which has maximum event Id which can be used as a value. I am not sure how this can be achieved. Please assist.
I would like to achieve this using lambda in single line code.
I would like to achieve this using lambda in single line code.Why?Eventbased ongroupIdwhen all you want as an end result is anEventthat has the highestevenId? if so just query theList<Event>if not then please elaborate...Eventof each group?