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

com.github.phantomthief.util.MoreRunnables Maven / Gradle / Ivy

There is a newer version: 0.1.55
Show newest version
package com.github.phantomthief.util;

import java.util.function.Supplier;

/**
 * @author w.vela
 */
public final class MoreRunnables {

    public static Runnable runOnce(Runnable runnable) {
        return new Runnable() {

            private final Supplier supplier = MoreSuppliers.lazy(() -> {
                runnable.run();
                return null;
            });

            @Override
            public void run() {
                supplier.get();
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy