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

com.github.andyshao.util.function.ThrowableSupplier Maven / Gradle / Ivy

The newest version!
package com.github.andyshao.util.function;

import com.github.andyshao.lang.Convert;
import com.github.andyshao.util.stream.ThrowableException;

import java.util.function.Supplier;

/**
 * 
 * 
 * Title:
* Descript:
* Copyright: Copryright(c) Jun 5, 2019
* Encoding: UNIX UTF-8 * * @author Andy.Shao * * @param return type * @see ExceptionableSupplier * @see Supplier * @deprecated repeated */ @Deprecated(since = "5.0.0.RELEASE") public interface ThrowableSupplier { /** * get operation * @return ret * @throws Throwable any error */ R get() throws Throwable; /** * to {@link ExceptionableSupplier} * @return {@link ExceptionableSupplier} * @param return type */ static Convert, ExceptionableSupplier> toExceptionableSupplier() { return input -> { return new ExceptionableSupplier() { @Override public R get() throws Exception { try { return input.get(); } catch (Throwable e) { throw ThrowableException.convertToException(e); } } }; }; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy