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

com.wangjiegulu.rapidooo.library.compiler.util.LogicUtil Maven / Gradle / Ivy

package com.wangjiegulu.rapidooo.library.compiler.util;

import com.wangjiegulu.rapidooo.library.compiler.exception.RapidOOOCompileException;
import com.wangjiegulu.rapidooo.library.compiler.util.func.Func1R;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: wangjie Email: [email protected] Date: 2019-06-14.
 */
public class LogicUtil {
    public static  T checkNullCondition(T t, String s) {
        if (null == t) {
            throw new RapidOOOCompileException(s);
        }
        return t;
    }

    public static  List count(Func1R func, T...ts){
        List result = new ArrayList<>();
        for(T t : ts){
            if(func.call(t)){
                result.add(t);
            }
        }
        return result;
    }

    public static List countBoolean(Boolean...ts){
        return count(new Func1R() {
            @Override
            public Boolean call(Boolean aBoolean) {
                return aBoolean;
            }
        }, ts);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy