I have an arraylist that contains list of objects like below:
[Activities(id=3116, studentID=5c1a7986c98da061141475b4, actionID=1234, actionName=hohoho, totalPoints=100),
Activities(id=3117, studentID=5c1a7986c98da061141475b4, actionID=4321, actionName=lalala, totalPoints=7),
Activities(id=3118, studentID=5c1a7986c98da061141475b4, actionID=4321, actionName=lalala, totalPoints=4),
Activities(id=3119, studentID=5c1a7986c98da061141475b4, actionID=1234, actionName=hohoho, totalPoints=10)]
Is there any kotlin functions that I can use that can sum the totalPoints based on group actionID from above? If the above arraylist is in sql instead, I can do something like SELECT actionID, SUM(totalPoints) FROM activities GROUP BY actionID, which will return
actionID totalPoints
1234 110
4321 11