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

com.landawn.abacus.util.Throwables Maven / Gradle / Ivy

Go to download

A general programming library in Java/Android. It's easy to learn and simple to use with concise and powerful APIs.

There is a newer version: 2.1.12
Show newest version
/*
 * Copyright (C) 2019 HaiYang Li
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.landawn.abacus.util;

// TODO: Auto-generated Javadoc
/**
 * Catch checked exception and convert it to RuntimeException.
 *
 * @author Haiyang Li
 * @param 
 * @since 0.8
 */
public final class Throwables {

    private Throwables() {
        // Singleton for utility class.
    }

    /**
     *
     * @param cmd
     * @throws RuntimeException if some error happens
     */
    public static void run(final Throwables.Runnable cmd) {
        try {
            cmd.run();
        } catch (Throwable e) {
            throw N.toRuntimeException(e);
        }
    }

    /**
     *
     * @param cmd
     * @param actionOnError
     */
    public static void run(final Throwables.Runnable cmd,
            final com.landawn.abacus.util.function.Consumer actionOnError) {
        N.checkArgNotNull(actionOnError);

        try {
            cmd.run();
        } catch (Throwable e) {
            actionOnError.accept(e);
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @return
     * @throws RuntimeException if some error happens
     */
    public static  R call(final Throwables.Callable cmd) {
        try {
            return cmd.call();
        } catch (Throwable e) {
            throw N.toRuntimeException(e);
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @param actionOnError
     * @return
     */
    public static  R call(final Throwables.Callable cmd,
            final com.landawn.abacus.util.function.Function actionOnError) {
        N.checkArgNotNull(actionOnError);

        try {
            return cmd.call();
        } catch (Throwable e) {
            return actionOnError.apply(e);
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @param supplier
     * @return
     */
    public static  R call(final Throwables.Callable cmd, final com.landawn.abacus.util.function.Supplier supplier) {
        N.checkArgNotNull(supplier);

        try {
            return cmd.call();
        } catch (Throwable e) {
            return supplier.get();
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @param defaultValue
     * @return
     */
    public static  R call(final Throwables.Callable cmd, final R defaultValue) {
        try {
            return cmd.call();
        } catch (Throwable e) {
            return defaultValue;
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @param predicate
     * @param supplier
     * @return
     * @throws RuntimeException if some error happens and predicate return false.
     */
    public static  R call(final Throwables.Callable cmd,
            final com.landawn.abacus.util.function.Predicate predicate, final com.landawn.abacus.util.function.Supplier supplier) {
        N.checkArgNotNull(predicate);
        N.checkArgNotNull(supplier);

        try {
            return cmd.call();
        } catch (Throwable e) {
            if (predicate.test(e)) {
                return supplier.get();
            } else {
                throw N.toRuntimeException(e);
            }
        }
    }

    /**
     *
     * @param 
     * @param cmd
     * @param predicate
     * @param defaultValue
     * @return
     * @throws RuntimeException if some error happens and predicate return false.
     */
    public static  R call(final Throwables.Callable cmd,
            final com.landawn.abacus.util.function.Predicate predicate, final R defaultValue) {
        N.checkArgNotNull(predicate);

        try {
            return cmd.call();
        } catch (Throwable e) {
            if (predicate.test(e)) {
                return defaultValue;
            } else {
                throw N.toRuntimeException(e);
            }
        }
    }

    /**
     * The Interface Runnable.
     *
     * @param 
     */
    public static interface Runnable {

        /**
         *
         * @throws E the e
         */
        void run() throws E;
    }

    /**
     * The Interface Callable.
     *
     * @param 
     * @param 
     */
    public static interface Callable {

        /**
         *
         * @return
         * @throws E the e
         */
        R call() throws E;
    }

    /**
     * The Interface Supplier.
     *
     * @param 
     * @param 
     */
    public static interface Supplier {

        /**
         *
         * @return
         * @throws E the e
         */
        T get() throws E;
    }

    /**
     * The Interface BooleanSupplier.
     *
     * @param 
     */
    public static interface BooleanSupplier {

        /**
         * Gets the as boolean.
         *
         * @return
         * @throws E the e
         */
        boolean getAsBoolean() throws E;
    }

    /**
     * The Interface CharSupplier.
     *
     * @param 
     */
    public static interface CharSupplier {

        /**
         * Gets the as char.
         *
         * @return
         * @throws E the e
         */
        char getAsChar() throws E;
    }

    /**
     * The Interface ByteSupplier.
     *
     * @param 
     */
    public static interface ByteSupplier {

        /**
         * Gets the as byte.
         *
         * @return
         * @throws E the e
         */
        byte getAsByte() throws E;
    }

    /**
     * The Interface ShortSupplier.
     *
     * @param 
     */
    public static interface ShortSupplier {

        /**
         * Gets the as short.
         *
         * @return
         * @throws E the e
         */
        short getAsShort() throws E;
    }

    /**
     * The Interface IntSupplier.
     *
     * @param 
     */
    public static interface IntSupplier {

        /**
         * Gets the as int.
         *
         * @return
         * @throws E the e
         */
        int getAsInt() throws E;
    }

    /**
     * The Interface LongSupplier.
     *
     * @param 
     */
    public static interface LongSupplier {

        /**
         * Gets the as long.
         *
         * @return
         * @throws E the e
         */
        long getAsLong() throws E;
    }

    /**
     * The Interface FloatSupplier.
     *
     * @param 
     */
    public static interface FloatSupplier {

        /**
         * Gets the as float.
         *
         * @return
         * @throws E the e
         */
        float getAsFloat() throws E;
    }

    /**
     * The Interface DoubleSupplier.
     *
     * @param 
     */
    public static interface DoubleSupplier {

        /**
         * Gets the as double.
         *
         * @return
         * @throws E the e
         */
        double getAsDouble() throws E;
    }

    /**
     * The Interface Predicate.
     *
     * @param 
     * @param 
     */
    public static interface Predicate {

        /**
         *
         * @param t
         * @return true, if successful
         * @throws E the e
         */
        boolean test(T t) throws E;
    }

    /**
     * The Interface BiPredicate.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface BiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(T t, U u) throws E;
    }

    /**
     * The Interface TriPredicate.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface TriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(A a, B b, C c) throws E;
    }

    /**
     * The Interface QuadPredicate.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface QuadPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @param d
         * @return true, if successful
         * @throws E the e
         */
        boolean test(A a, B b, C c, D d) throws E;
    }

    /**
     * The Interface Function.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface Function {

        /**
         *
         * @param t
         * @return
         * @throws E the e
         */
        R apply(T t) throws E;
    }

    /**
     * The Interface BiFunction.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface BiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(T t, U u) throws E;
    }

    /**
     * The Interface TriFunction.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface TriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(A a, B b, C c) throws E;
    }

    /**
     * The Interface QuadFunction.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface QuadFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @param d
         * @return
         * @throws E the e
         */
        R apply(A a, B b, C c, D d) throws E;
    }

    /**
     * The Interface Consumer.
     *
     * @param 
     * @param 
     */
    public static interface Consumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(T t) throws E;
    }

    /**
     * The Interface BiConsumer.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface BiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(T t, U u) throws E;
    }

    /**
     * The Interface TriConsumer.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface TriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(A a, B b, C c) throws E;
    }

    /**
     * The Interface QuadConsumer.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface QuadConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @param d
         * @throws E the e
         */
        void accept(A a, B b, C c, D d) throws E;
    }

    /**
     * The Interface IndexedConsumer.
     *
     * @param 
     * @param 
     */
    public static interface IndexedConsumer {

        /**
         *
         * @param idx
         * @param e
         * @throws E the e
         */
        void accept(int idx, T e) throws E;
    }

    /**
     * The Interface IndexedBiConsumer.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface IndexedBiConsumer {

        /**
         *
         * @param u
         * @param idx
         * @param e
         * @throws E the e
         */
        void accept(U u, int idx, T e) throws E;
    }

    /**
     * The Interface IndexedFunction.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface IndexedFunction {

        /**
         *
         * @param idx
         * @param e
         * @return
         * @throws E the e
         */
        R apply(int idx, T e) throws E;
    }

    /**
     * The Interface IndexedBiFunction.
     *
     * @param 
     * @param 
     * @param 
     * @param 
     */
    public static interface IndexedBiFunction {

        /**
         *
         * @param u
         * @param idx
         * @param e
         * @return
         * @throws E the e
         */
        R apply(U u, int idx, T e) throws E;
    }

    /**
     * The Interface IndexedPredicate.
     *
     * @param 
     * @param 
     */
    public static interface IndexedPredicate {

        /**
         *
         * @param idx
         * @param e
         * @return true, if successful
         * @throws E the e
         */
        boolean test(int idx, T e) throws E;
    }

    /**
     * The Interface IndexedBiPredicate.
     *
     * @param 
     * @param 
     * @param 
     */
    public static interface IndexedBiPredicate {

        /**
         *
         * @param u
         * @param idx
         * @param e
         * @return true, if successful
         * @throws E the e
         */
        boolean test(U u, int idx, T e) throws E;
    }

    /**
     * The Interface BooleanPredicate.
     *
     * @param 
     */
    public static interface BooleanPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(boolean value) throws E;
    }

    /**
     * The Interface BooleanFunction.
     *
     * @param 
     * @param 
     */
    public static interface BooleanFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(boolean value) throws E;
    }

    /**
     * The Interface BooleanConsumer.
     *
     * @param 
     */
    public static interface BooleanConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(boolean t) throws E;
    }

    /**
     * The Interface CharPredicate.
     *
     * @param 
     */
    public static interface CharPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(char value) throws E;
    }

    /**
     * The Interface CharFunction.
     *
     * @param 
     * @param 
     */
    public static interface CharFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(char value) throws E;
    }

    /**
     * The Interface CharConsumer.
     *
     * @param 
     */
    public static interface CharConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(char t) throws E;
    }

    /**
     * The Interface BytePredicate.
     *
     * @param 
     */
    public static interface BytePredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(byte value) throws E;
    }

    /**
     * The Interface ByteFunction.
     *
     * @param 
     * @param 
     */
    public static interface ByteFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(byte value) throws E;
    }

    /**
     * The Interface ByteConsumer.
     *
     * @param 
     */
    public static interface ByteConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(byte t) throws E;
    }

    /**
     * The Interface ShortPredicate.
     *
     * @param 
     */
    public static interface ShortPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(short value) throws E;
    }

    /**
     * The Interface ShortFunction.
     *
     * @param 
     * @param 
     */
    public static interface ShortFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(short value) throws E;
    }

    /**
     * The Interface ShortConsumer.
     *
     * @param 
     */
    public static interface ShortConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(short t) throws E;
    }

    /**
     * The Interface IntPredicate.
     *
     * @param 
     */
    public static interface IntPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(int value) throws E;
    }

    /**
     * The Interface IntFunction.
     *
     * @param 
     * @param 
     */
    public static interface IntFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(int value) throws E;
    }

    /**
     * The Interface IntConsumer.
     *
     * @param 
     */
    public static interface IntConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(int t) throws E;
    }

    /**
     * The Interface LongPredicate.
     *
     * @param 
     */
    public static interface LongPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(long value) throws E;
    }

    /**
     * The Interface LongFunction.
     *
     * @param 
     * @param 
     */
    public static interface LongFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(long value) throws E;
    }

    /**
     * The Interface LongConsumer.
     *
     * @param 
     */
    public static interface LongConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(long t) throws E;
    }

    /**
     * The Interface FloatPredicate.
     *
     * @param 
     */
    public static interface FloatPredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(float value) throws E;
    }

    /**
     * The Interface FloatFunction.
     *
     * @param 
     * @param 
     */
    public static interface FloatFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(float value) throws E;
    }

    /**
     * The Interface FloatConsumer.
     *
     * @param 
     */
    public static interface FloatConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(float t) throws E;
    }

    /**
     * The Interface DoublePredicate.
     *
     * @param 
     */
    public static interface DoublePredicate {

        /**
         *
         * @param value
         * @return true, if successful
         * @throws E the e
         */
        boolean test(double value) throws E;
    }

    /**
     * The Interface DoubleFunction.
     *
     * @param 
     * @param 
     */
    public static interface DoubleFunction {

        /**
         *
         * @param value
         * @return
         * @throws E the e
         */
        R apply(double value) throws E;
    }

    /**
     * The Interface DoubleConsumer.
     *
     * @param 
     */
    public static interface DoubleConsumer {

        /**
         *
         * @param t
         * @throws E the e
         */
        void accept(double t) throws E;
    }

    /**
     * The Interface ToBooleanFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToBooleanFunction {

        /**
         * Apply as boolean.
         *
         * @param t
         * @return true, if successful
         * @throws E the e
         */
        boolean applyAsBoolean(T t) throws E;
    }

    /**
     * The Interface ToCharFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToCharFunction {

        /**
         * Apply as char.
         *
         * @param t
         * @return
         * @throws E the e
         */
        char applyAsChar(T t) throws E;
    }

    /**
     * The Interface ToByteFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToByteFunction {

        /**
         * Apply as byte.
         *
         * @param t
         * @return
         * @throws E the e
         */
        byte applyAsByte(T t) throws E;
    }

    /**
     * The Interface ToShortFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToShortFunction {

        /**
         * Apply as short.
         *
         * @param t
         * @return
         * @throws E the e
         */
        short applyAsShort(T t) throws E;
    }

    /**
     * The Interface ToIntFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToIntFunction {

        /**
         * Apply as int.
         *
         * @param t
         * @return
         * @throws E the e
         */
        int applyAsInt(T t) throws E;
    }

    /**
     * The Interface ToLongFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToLongFunction {

        /**
         * Apply as long.
         *
         * @param t
         * @return
         * @throws E the e
         */
        long applyAsLong(T t) throws E;
    }

    /**
     * The Interface ToFloatFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToFloatFunction {

        /**
         * Apply as float.
         *
         * @param t
         * @return
         * @throws E the e
         */
        float applyAsFloat(T t) throws E;
    }

    /**
     * The Interface ToDoubleFunction.
     *
     * @param 
     * @param 
     */
    public static interface ToDoubleFunction {

        /**
         * Apply as double.
         *
         * @param t
         * @return
         * @throws E the e
         */
        double applyAsDouble(T t) throws E;
    }

    /**
     * The Interface UnaryOperator.
     *
     * @param 
     * @param 
     */
    public static interface UnaryOperator extends Function {
    }

    /**
     * The Interface BinaryOperator.
     *
     * @param 
     * @param 
     */
    public static interface BinaryOperator extends BiFunction {
    }

    /**
     * The Interface TernaryOperator.
     *
     * @param 
     * @param 
     */
    public static interface TernaryOperator extends BiFunction {
    }

    /**
     * The Interface BooleanUnaryOperator.
     *
     * @param 
     */
    public static interface BooleanUnaryOperator {

        /**
         * Apply as boolean.
         *
         * @param operand
         * @return true, if successful
         * @throws E the e
         */
        boolean applyAsBoolean(boolean operand) throws E;
    }

    /**
     * The Interface CharUnaryOperator.
     *
     * @param 
     */
    public static interface CharUnaryOperator {

        /**
         * Apply as char.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        char applyAsChar(char operand) throws E;
    }

    /**
     * The Interface ByteUnaryOperator.
     *
     * @param 
     */
    public static interface ByteUnaryOperator {

        /**
         * Apply as byte.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        byte applyAsByte(byte operand) throws E;
    }

    /**
     * The Interface ShortUnaryOperator.
     *
     * @param 
     */
    public static interface ShortUnaryOperator {

        /**
         * Apply as short.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        short applyAsShort(short operand) throws E;
    }

    /**
     * The Interface IntUnaryOperator.
     *
     * @param 
     */
    public static interface IntUnaryOperator {

        /**
         * Apply as int.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        int applyAsInt(int operand) throws E;
    }

    /**
     * The Interface LongUnaryOperator.
     *
     * @param 
     */
    public static interface LongUnaryOperator {

        /**
         * Apply as long.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        long applyAsLong(long operand) throws E;
    }

    /**
     * The Interface FloatUnaryOperator.
     *
     * @param 
     */
    public static interface FloatUnaryOperator {

        /**
         * Apply as float.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        float applyAsFloat(float operand) throws E;
    }

    /**
     * The Interface DoubleUnaryOperator.
     *
     * @param 
     */
    public static interface DoubleUnaryOperator {

        /**
         * Apply as double.
         *
         * @param operand
         * @return
         * @throws E the e
         */
        double applyAsDouble(double operand) throws E;
    }

    /**
     * The Interface BooleanBinaryOperator.
     *
     * @param 
     */
    public static interface BooleanBinaryOperator {

        /**
         * Apply as boolean.
         *
         * @param left
         * @param right
         * @return true, if successful
         * @throws E the e
         */
        boolean applyAsBoolean(boolean left, boolean right) throws E;
    }

    /**
     * The Interface CharBinaryOperator.
     *
     * @param 
     */
    public static interface CharBinaryOperator {

        /**
         * Apply as char.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        char applyAsChar(char left, char right) throws E;
    }

    /**
     * The Interface ByteBinaryOperator.
     *
     * @param 
     */
    public static interface ByteBinaryOperator {

        /**
         * Apply as byte.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        byte applyAsByte(byte left, byte right) throws E;
    }

    /**
     * The Interface ShortBinaryOperator.
     *
     * @param 
     */
    public static interface ShortBinaryOperator {

        /**
         * Apply as short.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        short applyAsShort(short left, short right) throws E;
    }

    /**
     * The Interface IntBinaryOperator.
     *
     * @param 
     */
    public static interface IntBinaryOperator {

        /**
         * Apply as int.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        int applyAsInt(int left, int right) throws E;
    }

    /**
     * The Interface LongBinaryOperator.
     *
     * @param 
     */
    public static interface LongBinaryOperator {

        /**
         * Apply as long.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        long applyAsLong(long left, long right) throws E;
    }

    /**
     * The Interface FloatBinaryOperator.
     *
     * @param 
     */
    public static interface FloatBinaryOperator {

        /**
         * Apply as float.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        float applyAsFloat(float left, float right) throws E;
    }

    /**
     * The Interface DoubleBinaryOperator.
     *
     * @param 
     */
    public static interface DoubleBinaryOperator {

        /**
         * Apply as double.
         *
         * @param left
         * @param right
         * @return
         * @throws E the e
         */
        double applyAsDouble(double left, double right) throws E;
    }

    /**
     * The Interface BooleanTernaryOperator.
     *
     * @param 
     */
    public static interface BooleanTernaryOperator {

        /**
         * Apply as boolean.
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean applyAsBoolean(boolean a, boolean b, boolean c) throws E;
    }

    /**
     * The Interface CharTernaryOperator.
     *
     * @param 
     */
    public static interface CharTernaryOperator {

        /**
         * Apply as char.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        char applyAsChar(char a, char b, char c) throws E;
    }

    /**
     * The Interface ByteTernaryOperator.
     *
     * @param 
     */
    public static interface ByteTernaryOperator {

        /**
         * Apply as byte.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        byte applyAsByte(byte a, byte b, byte c) throws E;
    }

    /**
     * The Interface ShortTernaryOperator.
     *
     * @param 
     */
    public static interface ShortTernaryOperator {

        /**
         * Apply as short.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        short applyAsShort(short a, short b, short c) throws E;
    }

    /**
     * The Interface IntTernaryOperator.
     *
     * @param 
     */
    public static interface IntTernaryOperator {

        /**
         * Apply as int.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        int applyAsInt(int a, int b, int c) throws E;
    }

    /**
     * The Interface LongTernaryOperator.
     *
     * @param 
     */
    public static interface LongTernaryOperator {

        /**
         * Apply as long.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        long applyAsLong(long a, long b, long c) throws E;
    }

    /**
     * The Interface FloatTernaryOperator.
     *
     * @param 
     */
    public static interface FloatTernaryOperator {

        /**
         * Apply as float.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        float applyAsFloat(float a, float b, float c) throws E;
    }

    /**
     * The Interface DoubleTernaryOperator.
     *
     * @param 
     */
    public static interface DoubleTernaryOperator {

        /**
         * Apply as double.
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        double applyAsDouble(double a, double b, double c) throws E;
    }

    /**
     * The Interface BooleanBiPredicate.
     *
     * @param 
     */
    public static interface BooleanBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(boolean t, boolean u) throws E;
    }

    /**
     * The Interface CharBiPredicate.
     *
     * @param 
     */
    public static interface CharBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(char t, char u) throws E;
    }

    /**
     * The Interface ByteBiPredicate.
     *
     * @param 
     */
    public static interface ByteBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(byte t, byte u) throws E;
    }

    /**
     * The Interface ShortBiPredicate.
     *
     * @param 
     */
    public static interface ShortBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(short t, short u) throws E;
    }

    /**
     * The Interface IntBiPredicate.
     *
     * @param 
     */
    public static interface IntBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(int t, int u) throws E;
    }

    /**
     * The Interface LongBiPredicate.
     *
     * @param 
     */
    public static interface LongBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(long t, long u) throws E;
    }

    /**
     * The Interface FloatBiPredicate.
     *
     * @param 
     */
    public static interface FloatBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(float t, float u) throws E;
    }

    /**
     * The Interface DoubleBiPredicate.
     *
     * @param 
     */
    public static interface DoubleBiPredicate {

        /**
         *
         * @param t
         * @param u
         * @return true, if successful
         * @throws E the e
         */
        boolean test(double t, double u) throws E;
    }

    /**
     * The Interface BooleanBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface BooleanBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(boolean t, boolean u) throws E;
    }

    /**
     * The Interface CharBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface CharBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(char t, char u) throws E;
    }

    /**
     * The Interface ByteBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface ByteBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(byte t, byte u) throws E;
    }

    /**
     * The Interface ShortBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface ShortBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(short t, short u) throws E;
    }

    /**
     * The Interface IntBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface IntBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(int t, int u) throws E;
    }

    /**
     * The Interface LongBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface LongBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(long t, long u) throws E;
    }

    /**
     * The Interface FloatBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface FloatBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(float t, float u) throws E;
    }

    /**
     * The Interface DoubleBiFunction.
     *
     * @param 
     * @param 
     */
    public static interface DoubleBiFunction {

        /**
         *
         * @param t
         * @param u
         * @return
         * @throws E the e
         */
        R apply(double t, double u) throws E;
    }

    /**
     * The Interface BooleanBiConsumer.
     *
     * @param 
     */
    public static interface BooleanBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(boolean t, boolean u) throws E;
    }

    /**
     * The Interface CharBiConsumer.
     *
     * @param 
     */
    public static interface CharBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(char t, char u) throws E;
    }

    /**
     * The Interface ByteBiConsumer.
     *
     * @param 
     */
    public static interface ByteBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(byte t, byte u) throws E;
    }

    /**
     * The Interface ShortBiConsumer.
     *
     * @param 
     */
    public static interface ShortBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(short t, short u) throws E;
    }

    /**
     * The Interface IntBiConsumer.
     *
     * @param 
     */
    public static interface IntBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(int t, int u) throws E;
    }

    /**
     * The Interface LongBiConsumer.
     *
     * @param 
     */
    public static interface LongBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(long t, long u) throws E;
    }

    /**
     * The Interface FloatBiConsumer.
     *
     * @param 
     */
    public static interface FloatBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(float t, float u) throws E;
    }

    /**
     * The Interface DoubleBiConsumer.
     *
     * @param 
     */
    public static interface DoubleBiConsumer {

        /**
         *
         * @param t
         * @param u
         * @throws E the e
         */
        void accept(double t, double u) throws E;
    }

    /**
     * The Interface BooleanTriPredicate.
     *
     * @param 
     */
    public static interface BooleanTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(boolean a, boolean b, boolean c) throws E;
    }

    /**
     * The Interface CharTriPredicate.
     *
     * @param 
     */
    public static interface CharTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(char a, char b, char c) throws E;
    }

    /**
     * The Interface ByteTriPredicate.
     *
     * @param 
     */
    public static interface ByteTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(byte a, byte b, byte c) throws E;
    }

    /**
     * The Interface ShortTriPredicate.
     *
     * @param 
     */
    public static interface ShortTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(short a, short b, short c) throws E;
    }

    /**
     * The Interface IntTriPredicate.
     *
     * @param 
     */
    public static interface IntTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(int a, int b, int c) throws E;
    }

    /**
     * The Interface LongTriPredicate.
     *
     * @param 
     */
    public static interface LongTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(long a, long b, long c) throws E;
    }

    /**
     * The Interface FloatTriPredicate.
     *
     * @param 
     */
    public static interface FloatTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(float a, float b, float c) throws E;
    }

    /**
     * The Interface DoubleTriPredicate.
     *
     * @param 
     */
    public static interface DoubleTriPredicate {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return true, if successful
         * @throws E the e
         */
        boolean test(double a, double b, double c) throws E;
    }

    /**
     * The Interface BooleanTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface BooleanTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(boolean a, boolean b, boolean c) throws E;
    }

    /**
     * The Interface CharTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface CharTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(char a, char b, char c) throws E;
    }

    /**
     * The Interface ByteTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface ByteTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(byte a, byte b, byte c) throws E;
    }

    /**
     * The Interface ShortTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface ShortTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(short a, short b, short c) throws E;
    }

    /**
     * The Interface IntTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface IntTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(int a, int b, int c) throws E;
    }

    /**
     * The Interface LongTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface LongTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(long a, long b, long c) throws E;
    }

    /**
     * The Interface FloatTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface FloatTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(float a, float b, float c) throws E;
    }

    /**
     * The Interface DoubleTriFunction.
     *
     * @param 
     * @param 
     */
    public static interface DoubleTriFunction {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @return
         * @throws E the e
         */
        R apply(double a, double b, double c) throws E;
    }

    /**
     * The Interface BooleanTriConsumer.
     *
     * @param 
     */
    public static interface BooleanTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(boolean a, boolean b, boolean c) throws E;
    }

    /**
     * The Interface CharTriConsumer.
     *
     * @param 
     */
    public static interface CharTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(char a, char b, char c) throws E;
    }

    /**
     * The Interface ByteTriConsumer.
     *
     * @param 
     */
    public static interface ByteTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(byte a, byte b, byte c) throws E;
    }

    /**
     * The Interface ShortTriConsumer.
     *
     * @param 
     */
    public static interface ShortTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(short a, short b, short c) throws E;
    }

    /**
     * The Interface IntTriConsumer.
     *
     * @param 
     */
    public static interface IntTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(int a, int b, int c) throws E;
    }

    /**
     * The Interface LongTriConsumer.
     *
     * @param 
     */
    public static interface LongTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(long a, long b, long c) throws E;
    }

    /**
     * The Interface FloatTriConsumer.
     *
     * @param 
     */
    public static interface FloatTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(float a, float b, float c) throws E;
    }

    /**
     * The Interface DoubleTriConsumer.
     *
     * @param 
     */
    public static interface DoubleTriConsumer {

        /**
         *
         * @param a
         * @param b
         * @param c
         * @throws E the e
         */
        void accept(double a, double b, double c) throws E;
    }

    /**
     * The Interface ObjBooleanConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjBooleanConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, boolean value) throws E;
    }

    /**
     * The Interface ObjCharConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjCharConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, char value) throws E;
    }

    /**
     * The Interface ObjByteConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjByteConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, byte value) throws E;
    }

    /**
     * The Interface ObjShortConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjShortConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, short value) throws E;
    }

    /**
     * The Interface ObjIntConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjIntConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, int value) throws E;
    }

    /**
     * The Interface ObjLongConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjLongConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, long value) throws E;
    }

    /**
     * The Interface ObjFloatConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjFloatConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, float value) throws E;
    }

    /**
     * The Interface ObjDoubleConsumer.
     *
     * @param 
     * @param 
     */
    public static interface ObjDoubleConsumer {

        /**
         *
         * @param t
         * @param value
         * @throws E the e
         */
        void accept(T t, double value) throws E;
    }

    /**
     * The Class EE.
     */
    public static final class EE {

        /**
         * Instantiates a new ee.
         */
        private EE() {
            // Singleton. Utility class.
        }

        /**
         * The Interface Runnable.
         *
         * @param 
         * @param 
         */
        public static interface Runnable {

            /**
             *
             * @throws E the e
             * @throws E2 the e2
             */
            void run() throws E, E2;
        }

        /**
         * The Interface Callable.
         *
         * @param 
         * @param 
         * @param 
         */
        public static interface Callable {

            /**
             *
             * @return
             * @throws E the e
             * @throws E2 the e2
             */
            R call() throws E, E2;
        }

        /**
         * The Interface Supplier.
         *
         * @param 
         * @param 
         * @param 
         */
        public static interface Supplier {

            /**
             *
             * @return
             * @throws E the e
             * @throws E2 the e2
             */
            T get() throws E, E2;
        }

        /**
         * The Interface Predicate.
         *
         * @param 
         * @param 
         * @param 
         */
        public static interface Predicate {

            /**
             *
             * @param t
             * @return true, if successful
             * @throws E the e
             * @throws E2 the e2
             */
            boolean test(T t) throws E, E2;
        }

        /**
         * The Interface BiPredicate.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface BiPredicate {

            /**
             *
             * @param t
             * @param u
             * @return true, if successful
             * @throws E the e
             * @throws E2 the e2
             */
            boolean test(T t, U u) throws E, E2;
        }

        /**
         * The Interface TriPredicate.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface TriPredicate {

            /**
             *
             * @param a
             * @param b
             * @param c
             * @return true, if successful
             * @throws E the e
             * @throws E2 the e2
             */
            boolean test(A a, B b, C c) throws E, E2;
        }

        /**
         * The Interface Function.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface Function {

            /**
             *
             * @param t
             * @return
             * @throws E the e
             * @throws E2 the e2
             */
            R apply(T t) throws E, E2;
        }

        /**
         * The Interface BiFunction.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface BiFunction {

            /**
             *
             * @param t
             * @param u
             * @return
             * @throws E the e
             * @throws E2 the e2
             */
            R apply(T t, U u) throws E, E2;
        }

        /**
         * The Interface TriFunction.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface TriFunction {

            /**
             *
             * @param a
             * @param b
             * @param c
             * @return
             * @throws E the e
             * @throws E2 the e2
             */
            R apply(A a, B b, C c) throws E, E2;
        }

        /**
         * The Interface Consumer.
         *
         * @param 
         * @param 
         * @param 
         */
        public static interface Consumer {

            /**
             *
             * @param t
             * @throws E the e
             * @throws E2 the e2
             */
            void accept(T t) throws E, E2;
        }

        /**
         * The Interface BiConsumer.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface BiConsumer {

            /**
             *
             * @param t
             * @param u
             * @throws E the e
             * @throws E2 the e2
             */
            void accept(T t, U u) throws E, E2;
        }

        /**
         * The Interface TriConsumer.
         *
         * @param 
         * @param 
         * @param 
         * @param 
         * @param 
         */
        public static interface TriConsumer {

            /**
             *
             * @param a
             * @param b
             * @param c
             * @throws E the e
             * @throws E2 the e2
             */
            void accept(A a, B b, C c) throws E, E2;
        }
    }
}