Implement partitionWithKey.
Implement partition.