com.g2forge.alexandria.java.function.tee.TeeFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-java Show documentation
Show all versions of ax-java Show documentation
Standard Java library and the basis of the ${alexandria.name} project.
package com.g2forge.alexandria.java.function.tee;
import java.util.function.Consumer;
import java.util.function.Function;
import com.g2forge.alexandria.java.tuple.ITuple2G_;
import com.g2forge.alexandria.java.tuple.implementations.Tuple2GSO;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class TeeFunction implements Function {
protected final Function function;
protected final Consumer super ITuple2G_ extends I, ? extends O>> consumer;
@Override
public O apply(I input) {
final O retVal = function.apply(input);
consumer.accept(new Tuple2GSO<>(input, retVal));
return retVal;
}
}