Getting selectedItems in TreeGrid in order of appearance

I have a TreeGrid with MultiSelect mode and want to iterate over the selected items in the exact order they appear from top to bottom… what would be the best way to accomplish that?

There’s already a discussion about it but concerning Table: https://vaadin.com/forum#!/thread/274395