I have a list of objects that looks like this :
ID:2000
Title:"Title 1"
Description:"My name is Marco"
ID:2000
Title:"Title 2"
Description:"My name is Luca"
ID:3000
Title:"Title 3"
Description:"My name is Paul"
ID:4000
Title:"Title 4"
Description:"My name is Anthony"
ID:4000
Title:"Title 5"
Description:"My name is Carl"
ID:4000
Title:"Title 6"
Description:"My name is Jadett"
now, I’d like to browse (traverse) it with a for each. But I want to traverse it starting from the same ID. So, first a foreach for the single/unique ID (2000, 3000, 4000, so 3 steps). Than, for each “ID” step, each Title/Description: so 2 steps for the ID 2000, 1 for the ID 3000 and 3 for the ID 4000. List is ordered by ID.
How can I do it? Group by? Uhm…
Yes, with a group by: