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

net.diversionmc.error.TryS Maven / Gradle / Ivy

There is a newer version: 1.29.2
Show newest version
package net.diversionmc.error;

import java.util.function.Supplier;

@FunctionalInterface
public interface TryS extends Supplier {
    T tryGet() throws E;

    @SuppressWarnings("OverlyBroadCatchBlock")
    default T get() {
        try {
            return tryGet();
        } catch (Exception e) {
            throw new ResultException(e);
        }
    }

    static  TryS of(Supplier f) {
        return f::get;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy