All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.stream.impl.intops.object.FlatMapToDoubleOperation Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.stream.impl.intops.object;

import org.infinispan.stream.impl.intops.IntermediateOperation;

import java.util.function.Function;
import java.util.stream.DoubleStream;
import java.util.stream.Stream;

/**
 * Performs flat map to double operation on a regular {@link Stream}
 * @param  the type of the input stream
 */
public class FlatMapToDoubleOperation implements IntermediateOperation, Double, DoubleStream> {
   private final Function function;

   public FlatMapToDoubleOperation(Function function) {
      this.function = function;
   }

   @Override
   public DoubleStream perform(Stream stream) {
      return stream.flatMapToDouble(function);
   }

   public Function getFunction() {
      return function;
   }
}