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

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

package com.tinkerpop.gremlin.groovy.function;

import groovy.lang.Closure;

import java.util.function.Supplier;

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

    private final Closure closure;

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

    @Override
    public A get() {
        return (A) this.closure.call();
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy