Implement partitioningBy()