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

com.tinkerpop.gremlin.groovy.function.GConsumer Maven / Gradle / Ivy

package com.tinkerpop.gremlin.groovy.function;

import groovy.lang.Closure;

import java.util.function.Consumer;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class GConsumer implements Consumer {

    private final Closure closure;

    public GConsumer(final Closure closure) {
        this.closure = closure;
    }

    @Override
    public void accept(A a) {
        this.closure.call(a);
    }

    public static GConsumer[] make(final Closure... closures) {
        final GConsumer[] functions = new GConsumer[closures.length];
        for (int i = 0; i < closures.length; i++) {
            functions[i] = new GConsumer(closures[i]);
        }
        return functions;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy