stream helper function to extract prefix as list