Best practice for filtering collection data when using code

I think you can use both. But a dataset has the advantage to navigate pages like —> loadMore / nextPage / previousPage and so on.