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

com.moon.mapping.processing.CollectUtils Maven / Gradle / Ivy

package com.moon.mapping.processing;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;

/**
 * @author benshaoye
 */
final class CollectUtils {

    private CollectUtils() {}

    static  T reduce(Iterable collect, BiFunction converter, T totalValue) {
        if (collect != null) {
            for (F item : collect) {
                totalValue = converter.apply(totalValue, item);
            }
        }
        return totalValue;
    }

    static  List emptyIfNull(List list) {
        return list == null ? new ArrayList<>() : list;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy