Use type inference where applicable when collecting iterators