| 12345678910111213141516 |
- package com.persagy.fm.scheduling.utils;
- import java.util.function.Consumer;
- import java.util.function.Predicate;
- public interface StreamUtil {
- static <T> void actionWhen(T t, Predicate<T> condition, Consumer<T> consumer) {
- if (condition.test(t)) consumer.accept(t);
- }
- static <T> void actionWhen(T t, Boolean flag, Consumer<T> consumer) {
- if (flag) consumer.accept(t);
- }
- }
|