This commit is contained in:
Looly 2022-11-27 15:24:41 +08:00
parent 3aac1e9af6
commit 3b3498c8a1
8 changed files with 22 additions and 5 deletions

View File

@ -34,6 +34,11 @@ public class ComposeFunction<A, B, C> implements Function<A, C>, Serializable {
private final Function<B, C> g; private final Function<B, C> g;
private final Function<A, ? extends B> f; private final Function<A, ? extends B> f;
/**
* 构造
* @param g 函数1
* @param f 函数2
*/
public ComposeFunction(final Function<B, C> g, final Function<A, ? extends B> f) { public ComposeFunction(final Function<B, C> g, final Function<A, ? extends B> f) {
this.g = Assert.notNull(g); this.g = Assert.notNull(g);
this.f = Assert.notNull(f); this.f = Assert.notNull(f);

View File

@ -9,6 +9,9 @@ import java.util.function.BiFunction;
/** /**
* SerBiFunction * SerBiFunction
* *
* @param <T> 参数1的类型
* @param <U> 参数2的类型
* @param <R> 返回值类型
* @author VampireAchao * @author VampireAchao
* @since 2022/6/8 * @since 2022/6/8
*/ */

View File

@ -7,10 +7,12 @@ import java.util.Objects;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
/** /**
* SerBiPred * 可序列化的BiPredicate
* *
* @param <T> 参数1的类型
* @param <U> 参数2的类型
* @author VampireAchao * @author VampireAchao
* @since 2022/6/8 * @since 6.0.0
*/ */
@FunctionalInterface @FunctionalInterface
public interface SerBiPredicate<T, U> extends BiPredicate<T, U>, Serializable { public interface SerBiPredicate<T, U> extends BiPredicate<T, U>, Serializable {

View File

@ -12,6 +12,7 @@ import java.util.function.BinaryOperator;
* *
* @author VampireAchao * @author VampireAchao
* @since 2022/6/8 * @since 2022/6/8
* @param <T> 参数和返回值类型
*/ */
@FunctionalInterface @FunctionalInterface
public interface SerBinaryOperator<T> extends BinaryOperator<T>, Serializable { public interface SerBinaryOperator<T> extends BinaryOperator<T>, Serializable {

View File

@ -10,6 +10,7 @@ import java.util.stream.Stream;
/** /**
* 可序列化的Consumer * 可序列化的Consumer
* *
* @param <T> 参数类型
* @author VampireAchao * @author VampireAchao
* @see Consumer * @see Consumer
*/ */
@ -47,7 +48,8 @@ public interface SerConsumer<T> extends Consumer<T>, Serializable {
*/ */
@SafeVarargs @SafeVarargs
static <T> SerConsumer<T> multi(final SerConsumer<T>... consumers) { static <T> SerConsumer<T> multi(final SerConsumer<T>... consumers) {
return Stream.of(consumers).reduce(SerConsumer::andThen).orElseGet(() -> o -> {}); return Stream.of(consumers).reduce(SerConsumer::andThen).orElseGet(() -> o -> {
});
} }
/** /**
@ -77,6 +79,7 @@ public interface SerConsumer<T> extends Consumer<T>, Serializable {
* @return nothing * @return nothing
*/ */
static <T> SerConsumer<T> nothing() { static <T> SerConsumer<T> nothing() {
return t -> {}; return t -> {
};
} }
} }

View File

@ -8,6 +8,8 @@ import java.util.function.Function;
/** /**
* 可序列化的Function * 可序列化的Function
* *
* @param <T> 参数类型
* @param <R> 返回值类型
* @author VampireAchao * @author VampireAchao
* @see Function * @see Function
*/ */

View File

@ -12,6 +12,7 @@ import java.util.stream.Stream;
* *
* @author VampireAchao * @author VampireAchao
* @see Predicate * @see Predicate
* @param <T> 参数类型
*/ */
@FunctionalInterface @FunctionalInterface
public interface SerPredicate<T> extends Predicate<T>, Serializable { public interface SerPredicate<T> extends Predicate<T>, Serializable {

View File

@ -9,9 +9,9 @@ import java.util.stream.Stream;
/** /**
* 可序列化的Supplier * 可序列化的Supplier
* *
* @param <R> 返回值类型
* @author VampireAchao * @author VampireAchao
* @see Supplier * @see Supplier
* @param <R> 返回值类型
*/ */
@FunctionalInterface @FunctionalInterface
public interface SerSupplier<R> extends Supplier<R>, Serializable { public interface SerSupplier<R> extends Supplier<R>, Serializable {