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

com.g2forge.alexandria.java.function.tee.TeeFunction Maven / Gradle / Ivy

There is a newer version: 0.0.18
Show newest version
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> consumer;

	@Override
	public O apply(I input) {
		final O retVal = function.apply(input);
		consumer.accept(new Tuple2GSO<>(input, retVal));
		return retVal;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy