com.ulisesbocchio.jasyptspringboot.util.Functional Maven / Gradle / Ivy
The newest version!
package com.ulisesbocchio.jasyptspringboot.util;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* Functional class.
*
* @author Sergio.U.Bocchio
* @version $Id: $Id
*/
public class Functional {
/**
* tap.
*
* @param consumer a {@link java.util.function.Consumer} object
* @param a T class
* @return a {@link java.util.function.Function} object
*/
public static Function tap(Consumer consumer) {
return t -> {
consumer.accept(t);
return t;
};
}
/**
* notNull.
*
* @param a T class
* @return a {@link java.util.function.Predicate} object
*/
public static Predicate notNull() {
return Objects::nonNull;
}
}