code: public <R> SparkStream<R> mapPartitions(@NonNull SerializableFunction<Iterator<? super T>, ? extends R> function) {
        return new SparkStream<>(rdd.mapPartitions(iterator -> {
           Configurator.INSTANCE.configure(configBroadcast.value());
           return Cast.as(function.apply(iterator));
        }));
     }
docs: Maps the objects in the stream by block using the given function
  
  @param <R>      the component type of the returning stream
  @param function the function to use to map objects
  @return the new stream