/** * Returns a new {@code Partition} {@code PTransform} that divides its input {@code PCollection} * into the given number of partitions, using the given partitioning function. * * @param numPartitions the number of partitions to divide the input {@code PCollection} into * @param partitionFn the function to invoke on each element to choose its output partition * @throws IllegalArgumentException if {@code numPartitions <= 0} */ public static <T> Partition<T> of(int numPartitions, PartitionFn<? super T> partitionFn) { return new Partition<>(new PartitionDoFn<T>(numPartitions, partitionFn)); }