Make group-by preserve the ordering of the original list.