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

com.slimgears.util.stream.Consumers Maven / Gradle / Ivy

There is a newer version: 0.7.58
Show newest version
package com.slimgears.util.stream;

import java.util.Arrays;
import java.util.function.Consumer;

public class Consumers {
    @SafeVarargs
    public static  T configure(T instance, Consumer... configs) {
        return configure(instance, combine(configs));
    }

    public static  T configure(T instance, Consumer config) {
        config.accept(instance);
        return instance;
    }

    @SafeVarargs
    public static  Consumer combine(Consumer... configs) {
        return obj -> Arrays.asList(configs).forEach(c -> c.accept(obj));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy