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

com.github.andyshao.util.function.ThrowableToDoubleFunction 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.ToDoubleFunction;

/**
 * 
 * Title:
* Descript:
* Copyright: Copryright(c) Jun 14, 2019
* Encoding: UNIX UTF-8 * * @author Andy.Shao * * @param argument type * @see ToDoubleFunction * @see ExceptionableToDoubleFunction * @deprecated repeated */ @Deprecated(since = "5.0.0.RELEASE") public interface ThrowableToDoubleFunction { /** * apply as double * @param value input * @return double value * @throws Throwable any error */ double applyAsDouble(T value) throws Throwable; /** * to {@link ExceptionableToDoubleFunction} * @return {@link ExceptionableToDoubleFunction} * @param data type */ static Convert, ExceptionableToDoubleFunction> toDoubleFunction() { return input -> { return t -> { try { return input.applyAsDouble(t); } catch (Throwable e) { throw ThrowableException.convertToException(e); } }; }; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy