Convert stream to list function.