com.landawn.abacus.util.Try Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abacus-android Show documentation
Show all versions of abacus-android Show documentation
A general and simple library for Android
/*
* Copyright (C) 2016 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;
/**
* Catch checked exception and convert it to RuntimeException
.
*
* @since 0.8
*
* @author Haiyang Li
*/
public final class Try {
private final T t;
Try(final T t) {
N.checkArgNotNull(t);
this.t = t;
}
public static Try of(final T t) {
return new Try<>(t);
}
public static Try of(final Supplier supplier) {
try {
return new Try<>(supplier.get());
} catch (Exception e) {
throw N.toRuntimeException(e);
}
}
// public static Try reader(final File file) {
// try {
// return of((Reader) new FileReader(file));
// } catch (FileNotFoundException e) {
// throw N.toRuntimeException(e);
// }
// }
//
// public static Try bufferedReader(final File file) {
// return of(IOUtil.newBufferedReader(file));
// }
//
// public static Try writer(final File file) {
// try {
// return of((Writer) new FileWriter(file));
// } catch (IOException e) {
// throw N.toRuntimeException(e);
// }
// }
//
// public static Try bufferedWriter(final File file) {
// return of(IOUtil.newBufferedWriter(file));
// }
//
// public static Try> lines(final File file) {
// final Reader reader = IOUtil.newBufferedReader(file);
//
// return new Try<>(Stream.of(reader).onClose(new java.lang.Runnable() {
// @Override
// public void run() {
// IOUtil.close(reader);
// }
// }));
// }
// public static java.lang.Runnable of(final Try.Runnable run) {
// return new java.lang.Runnable() {
// @Override
// public void run() {
// try {
// run.run();
// } catch (Exception e) {
// throw N.toRuntimeException(e);
// }
// }
// };
// }
//
// public static Try.Callable of(final java.util.concurrent.Callable call) {
// return new Try.Callable() {
// @Override
// public R call() {
// try {
// return call.call();
// } catch (Exception e) {
// throw N.toRuntimeException(e);
// }
// }
// };
// }
/**
*
* @param cmd
* @throws RuntimeException if some error happens
*/
public static void run(final Try.Runnable extends Exception> cmd) {
try {
cmd.run();
} catch (Exception e) {
throw N.toRuntimeException(e);
}
}
public static void run(final Try.Runnable extends Exception> cmd, final com.landawn.abacus.util.function.Consumer super Exception> actionOnError) {
N.checkArgNotNull(actionOnError);
try {
cmd.run();
} catch (Exception e) {
actionOnError.accept(e);
}
}
// /**
// *
// * @param cmd
// * @throws RuntimeException if some error happens
// */
// public static void run(final U init, final Try.Consumer super U, ? extends Exception> cmd) {
// try {
// cmd.accept(init);
// } catch (Exception e) {
// throw N.toRuntimeException(e);
// }
// }
//
// public static void run(final U init, final Try.Consumer super U, ? extends Exception> cmd,
// final com.landawn.abacus.util.function.Consumer super Exception> actionOnError) {
// N.checkArgNotNull(actionOnError);
//
// try {
// cmd.accept(init);
// } catch (Exception e) {
// actionOnError.accept(e);
// }
// }
/**
*
* @param cmd
* @return
* @throws RuntimeException if some error happens
*/
public static R call(final java.util.concurrent.Callable cmd) {
try {
return cmd.call();
} catch (Exception e) {
throw N.toRuntimeException(e);
}
}
public static R call(final java.util.concurrent.Callable cmd, final com.landawn.abacus.util.function.Function super Exception, R> actionOnError) {
N.checkArgNotNull(actionOnError);
try {
return cmd.call();
} catch (Exception e) {
return actionOnError.apply(e);
}
}
public static R call(final java.util.concurrent.Callable cmd, final com.landawn.abacus.util.function.Supplier supplier) {
N.checkArgNotNull(supplier);
try {
return cmd.call();
} catch (Exception e) {
return supplier.get();
}
}
public static R call(final java.util.concurrent.Callable cmd, final R defaultValue) {
try {
return cmd.call();
} catch (Exception e) {
return defaultValue;
}
}
/**
*
* @param cmd
* @param predicate
* @param supplier
* @return the value returned Supplier.get()
if some error happens and predicate
return true.
* @throws RuntimeException if some error happens and predicate
return false.
*/
public static R call(final java.util.concurrent.Callable cmd, final com.landawn.abacus.util.function.Predicate super Exception> predicate,
final com.landawn.abacus.util.function.Supplier supplier) {
N.checkArgNotNull(predicate);
N.checkArgNotNull(supplier);
try {
return cmd.call();
} catch (Exception e) {
if (predicate.test(e)) {
return supplier.get();
} else {
throw N.toRuntimeException(e);
}
}
}
/**
*
* @param cmd
* @param predicate
* @param defaultValue
* @return the defaultValue()
if some error happens and predicate
return true.
* @throws RuntimeException if some error happens and predicate
return false.
*/
public static R call(final java.util.concurrent.Callable cmd, final com.landawn.abacus.util.function.Predicate super Exception> predicate,
final R defaultValue) {
N.checkArgNotNull(predicate);
try {
return cmd.call();
} catch (Exception e) {
if (predicate.test(e)) {
return defaultValue;
} else {
throw N.toRuntimeException(e);
}
}
}
// /**
// * @param init
// * @param cmd
// * @return
// * @throws RuntimeException if some error happens
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd) {
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// throw N.toRuntimeException(e);
// }
// }
//
// /**
// *
// * @param init
// * @param cmd
// * @param actionOnError
// * @return
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd,
// final com.landawn.abacus.util.function.Function super Exception, R> actionOnError) {
// N.checkArgNotNull(actionOnError);
//
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// return actionOnError.apply(e);
// }
// }
//
// /**
// *
// * @param init
// * @param cmd
// * @param supplier
// * @return
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd,
// final com.landawn.abacus.util.function.Supplier supplier) {
// N.checkArgNotNull(supplier);
//
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// return supplier.get();
// }
// }
//
// /**
// *
// * @param init
// * @param cmd
// * @param defaultValue
// * @return
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd, final R defaultValue) {
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// return defaultValue;
// }
// }
//
// /**
// *
// * @param init
// * @param cmd
// * @param predicate
// * @param supplier
// * @return the value returned Supplier.get()
if some error happens and predicate
return true.
// * @throws RuntimeException if some error happens and predicate
return false.
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd,
// final com.landawn.abacus.util.function.Predicate super Exception> predicate, final com.landawn.abacus.util.function.Supplier supplier) {
// N.checkArgNotNull(predicate);
// N.checkArgNotNull(supplier);
//
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// if (predicate.test(e)) {
// return supplier.get();
// } else {
// throw N.toRuntimeException(e);
// }
// }
// }
//
// /**
// *
// * @param init
// * @param cmd
// * @param predicate
// * @param defaultValue
// * @return the defaultValue()
if some error happens and predicate
return true.
// * @throws RuntimeException if some error happens and predicate
return false.
// */
// public static R call(final U init, final Try.Function super U, R, ? extends Exception> cmd,
// final com.landawn.abacus.util.function.Predicate super Exception> predicate, final R defaultValue) {
// N.checkArgNotNull(predicate);
//
// try {
// return cmd.apply(init);
// } catch (Exception e) {
// if (predicate.test(e)) {
// return defaultValue;
// } else {
// throw N.toRuntimeException(e);
// }
// }
// }
// public static Try.Callable callable(final Try.Runnable cmd) {
// N.checkArgNotNull(cmd);
//
// return new Try.Callable() {
// @Override
// public Void call() throws E {
// cmd.run();
// return null;
// }
// };
// }
public T val() {
return t;
}
public void run(final Try.Consumer super T, ? extends Exception> cmd) {
try {
cmd.accept(t);
} catch (Exception e) {
throw N.toRuntimeException(e);
} finally {
IOUtil.close(t);
}
}
public void run(final Try.Consumer super T, ? extends Exception> cmd, final com.landawn.abacus.util.function.Consumer super Exception> actionOnError) {
N.checkArgNotNull(actionOnError);
try {
cmd.accept(t);
} catch (Exception e) {
actionOnError.accept(e);
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd) {
try {
return cmd.apply(t);
} catch (Exception e) {
throw N.toRuntimeException(e);
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd,
final com.landawn.abacus.util.function.Function super Exception, R> actionOnError) {
N.checkArgNotNull(actionOnError);
try {
return cmd.apply(t);
} catch (Exception e) {
return actionOnError.apply(e);
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd, final com.landawn.abacus.util.function.Supplier supplier) {
N.checkArgNotNull(supplier);
try {
return cmd.apply(t);
} catch (Exception e) {
return supplier.get();
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd, final R defaultValue) {
try {
return cmd.apply(t);
} catch (Exception e) {
return defaultValue;
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd, final com.landawn.abacus.util.function.Predicate super Exception> predicate,
final com.landawn.abacus.util.function.Supplier supplier) {
N.checkArgNotNull(predicate);
N.checkArgNotNull(supplier);
try {
return cmd.apply(t);
} catch (Exception e) {
if (predicate.test(e)) {
return supplier.get();
} else {
throw N.toRuntimeException(e);
}
} finally {
IOUtil.close(t);
}
}
public R call(final Try.Function super T, R, ? extends Exception> cmd, final com.landawn.abacus.util.function.Predicate super Exception> predicate,
final R defaultValue) {
N.checkArgNotNull(predicate);
try {
return cmd.apply(t);
} catch (Exception e) {
if (predicate.test(e)) {
return defaultValue;
} else {
throw N.toRuntimeException(e);
}
} finally {
IOUtil.close(t);
}
}
public static interface Runnable {
void run() throws E;
}
public static interface Callable extends java.util.concurrent.Callable {
@Override
R call() throws E;
}
public static interface Supplier {
T get() throws E;
}
public static interface BooleanSupplier {
boolean getAsBoolean() throws E;
}
public static interface CharSupplier {
char getAsChar() throws E;
}
public static interface ByteSupplier {
byte getAsByte() throws E;
}
public static interface ShortSupplier {
short getAsShort() throws E;
}
public static interface IntSupplier {
int getAsInt() throws E;
}
public static interface LongSupplier {
long getAsLong() throws E;
}
public static interface FloatSupplier {
float getAsFloat() throws E;
}
public static interface DoubleSupplier {
double getAsDouble() throws E;
}
public static interface Predicate {
boolean test(T t) throws E;
}
public static interface BiPredicate {
boolean test(T t, U u) throws E;
}
public static interface TriPredicate {
boolean test(A a, B b, C c) throws E;
}
public static interface QuadPredicate {
boolean test(A a, B b, C c, D d) throws E;
}
public static interface Function {
R apply(T t) throws E;
public static Function convert(final Consumer consumer) {
N.checkArgNotNull(consumer);
return new Function() {
@Override
public Void apply(T t) throws E {
consumer.accept(t);
return null;
}
};
}
}
public static interface BiFunction {
R apply(T t, U u) throws E;
public static BiFunction convert(final BiConsumer biConsumer) {
N.checkArgNotNull(biConsumer);
return new BiFunction() {
@Override
public Void apply(T t, U u) throws E {
biConsumer.accept(t, u);
return null;
}
};
}
}
public static interface TriFunction {
R apply(A a, B b, C c) throws E;
public static TriFunction convert(final TriConsumer triConsumer) {
N.checkArgNotNull(triConsumer);
return new TriFunction() {
@Override
public Void apply(A a, B b, C c) throws E {
triConsumer.accept(a, b, c);
return null;
}
};
}
}
public static interface QuadFunction {
R apply(A a, B b, C c, D d) throws E;
}
public static interface Consumer {
void accept(T t) throws E;
public static Consumer convert(final Function func) {
N.checkArgNotNull(func);
return new Consumer() {
@Override
public void accept(T t) throws E {
func.apply(t);
}
};
}
}
public static interface BiConsumer {
void accept(T t, U u) throws E;
public static BiConsumer convert(final BiFunction func) {
N.checkArgNotNull(func);
return new BiConsumer() {
@Override
public void accept(T t, U u) throws E {
func.apply(t, u);
}
};
}
}
public static interface TriConsumer {
void accept(A a, B b, C c) throws E;
public static TriConsumer convert(final TriFunction func) {
N.checkArgNotNull(func);
return new TriConsumer() {
@Override
public void accept(A a, B b, C c) throws E {
func.apply(a, b, c);
}
};
}
}
public static interface QuadConsumer {
void accept(A a, B b, C c, D d) throws E;
}
public static interface IndexedConsumer {
void accept(int idx, T e) throws E;
}
public static interface IndexedBiConsumer {
void accept(U u, int idx, T e) throws E;
}
public static interface IndexedFunction {
R apply(int idx, T e) throws E;
}
public static interface IndexedBiFunction {
R apply(U u, int idx, T e) throws E;
}
public static interface IndexedPredicate {
boolean test(int idx, T e) throws E;
}
public static interface IndexedBiPredicate {
boolean test(U u, int idx, T e) throws E;
}
public static interface BooleanPredicate {
boolean test(boolean value) throws E;
}
public static interface BooleanFunction {
R apply(boolean value) throws E;
}
public static interface BooleanConsumer {
void accept(boolean t) throws E;
}
public static interface CharPredicate {
boolean test(char value) throws E;
}
public static interface CharFunction {
R apply(char value) throws E;
}
public static interface CharConsumer {
void accept(char t) throws E;
}
public static interface BytePredicate {
boolean test(byte value) throws E;
}
public static interface ByteFunction {
R apply(byte value) throws E;
}
public static interface ByteConsumer {
void accept(byte t) throws E;
}
public static interface ShortPredicate {
boolean test(short value) throws E;
}
public static interface ShortFunction {
R apply(short value) throws E;
}
public static interface ShortConsumer {
void accept(short t) throws E;
}
public static interface IntPredicate {
boolean test(int value) throws E;
}
public static interface IntFunction {
R apply(int value) throws E;
}
public static interface IntConsumer {
void accept(int t) throws E;
}
public static interface LongPredicate {
boolean test(long value) throws E;
}
public static interface LongFunction {
R apply(long value) throws E;
}
public static interface LongConsumer {
void accept(long t) throws E;
}
public static interface FloatPredicate {
boolean test(float value) throws E;
}
public static interface FloatFunction {
R apply(float value) throws E;
}
public static interface FloatConsumer {
void accept(float t) throws E;
}
public static interface DoublePredicate {
boolean test(double value) throws E;
}
public static interface DoubleFunction {
R apply(double value) throws E;
}
public static interface DoubleConsumer {
void accept(double t) throws E;
}
public static interface ToBooleanFunction {
boolean applyAsBoolean(T t) throws E;
}
public static interface ToCharFunction {
char applyAsChar(T t) throws E;
}
public static interface ToByteFunction {
byte applyAsByte(T t) throws E;
}
public static interface ToShortFunction {
short applyAsShort(T t) throws E;
}
public static interface ToIntFunction {
int applyAsInt(T t) throws E;
}
public static interface ToLongFunction {
long applyAsLong(T t) throws E;
}
public static interface ToFloatFunction {
float applyAsFloat(T t) throws E;
}
public static interface ToDoubleFunction {
double applyAsDouble(T t) throws E;
}
public static interface UnaryOperator extends Function {
}
public static interface BinaryOperator extends BiFunction {
}
public static interface TernaryOperator extends BiFunction {
}
public static interface BooleanUnaryOperator {
boolean applyAsBoolean(boolean operand) throws E;
}
public static interface CharUnaryOperator {
char applyAsChar(char operand) throws E;
}
public static interface ByteUnaryOperator {
byte applyAsByte(byte operand) throws E;
}
public static interface ShortUnaryOperator {
short applyAsShort(short operand) throws E;
}
public static interface IntUnaryOperator {
int applyAsInt(int operand) throws E;
}
public static interface LongUnaryOperator {
long applyAsLong(long operand) throws E;
}
public static interface FloatUnaryOperator {
float applyAsFloat(float operand) throws E;
}
public static interface DoubleUnaryOperator {
double applyAsDouble(double operand) throws E;
}
public static interface BooleanBinaryOperator {
boolean applyAsBoolean(boolean left, boolean right) throws E;
}
public static interface CharBinaryOperator {
char applyAsChar(char left, char right) throws E;
}
public static interface ByteBinaryOperator {
byte applyAsByte(byte left, byte right) throws E;
}
public static interface ShortBinaryOperator {
short applyAsShort(short left, short right) throws E;
}
public static interface IntBinaryOperator {
int applyAsInt(int left, int right) throws E;
}
public static interface LongBinaryOperator {
long applyAsLong(long left, long right) throws E;
}
public static interface FloatBinaryOperator {
float applyAsFloat(float left, float right) throws E;
}
public static interface DoubleBinaryOperator {
double applyAsDouble(double left, double right) throws E;
}
public static interface BooleanTernaryOperator {
boolean applyAsBoolean(boolean a, boolean b, boolean c) throws E;
}
public static interface CharTernaryOperator {
char applyAsChar(char a, char b, char c) throws E;
}
public static interface ByteTernaryOperator {
byte applyAsByte(byte a, byte b, byte c) throws E;
}
public static interface ShortTernaryOperator {
short applyAsShort(short a, short b, short c) throws E;
}
public static interface IntTernaryOperator {
int applyAsInt(int a, int b, int c) throws E;
}
public static interface LongTernaryOperator {
long applyAsLong(long a, long b, long c) throws E;
}
public static interface FloatTernaryOperator {
float applyAsFloat(float a, float b, float c) throws E;
}
public static interface DoubleTernaryOperator {
double applyAsDouble(double a, double b, double c) throws E;
}
public static interface BooleanBiPredicate {
boolean test(boolean t, boolean u) throws E;
}
public static interface CharBiPredicate {
boolean test(char t, char u) throws E;
}
public static interface ByteBiPredicate {
boolean test(byte t, byte u) throws E;
}
public static interface ShortBiPredicate {
boolean test(short t, short u) throws E;
}
public static interface IntBiPredicate {
boolean test(int t, int u) throws E;
}
public static interface LongBiPredicate {
boolean test(long t, long u) throws E;
}
public static interface FloatBiPredicate {
boolean test(float t, float u) throws E;
}
public static interface DoubleBiPredicate {
boolean test(double t, double u) throws E;
}
public static interface BooleanBiFunction {
R apply(boolean t, boolean u) throws E;
}
public static interface CharBiFunction {
R apply(char t, char u) throws E;
}
public static interface ByteBiFunction {
R apply(byte t, byte u) throws E;
}
public static interface ShortBiFunction {
R apply(short t, short u) throws E;
}
public static interface IntBiFunction {
R apply(int t, int u) throws E;
}
public static interface LongBiFunction {
R apply(long t, long u) throws E;
}
public static interface FloatBiFunction {
R apply(float t, float u) throws E;
}
public static interface DoubleBiFunction {
R apply(double t, double u) throws E;
}
public static interface BooleanBiConsumer {
void accept(boolean t, boolean u) throws E;
}
public static interface CharBiConsumer {
void accept(char t, char u) throws E;
}
public static interface ByteBiConsumer {
void accept(byte t, byte u) throws E;
}
public static interface ShortBiConsumer {
void accept(short t, short u) throws E;
}
public static interface IntBiConsumer {
void accept(int t, int u) throws E;
}
public static interface LongBiConsumer {
void accept(long t, long u) throws E;
}
public static interface FloatBiConsumer {
void accept(float t, float u) throws E;
}
public static interface DoubleBiConsumer {
void accept(double t, double u) throws E;
}
public static interface BooleanTriPredicate {
boolean test(boolean a, boolean b, boolean c) throws E;
}
public static interface CharTriPredicate {
boolean test(char a, char b, char c) throws E;
}
public static interface ByteTriPredicate {
boolean test(byte a, byte b, byte c) throws E;
}
public static interface ShortTriPredicate {
boolean test(short a, short b, short c) throws E;
}
public static interface IntTriPredicate {
boolean test(int a, int b, int c) throws E;
}
public static interface LongTriPredicate {
boolean test(long a, long b, long c) throws E;
}
public static interface FloatTriPredicate {
boolean test(float a, float b, float c) throws E;
}
public static interface DoubleTriPredicate {
boolean test(double a, double b, double c) throws E;
}
public static interface BooleanTriFunction {
R apply(boolean a, boolean b, boolean c) throws E;
}
public static interface CharTriFunction {
R apply(char a, char b, char c) throws E;
}
public static interface ByteTriFunction {
R apply(byte a, byte b, byte c) throws E;
}
public static interface ShortTriFunction {
R apply(short a, short b, short c) throws E;
}
public static interface IntTriFunction {
R apply(int a, int b, int c) throws E;
}
public static interface LongTriFunction {
R apply(long a, long b, long c) throws E;
}
public static interface FloatTriFunction {
R apply(float a, float b, float c) throws E;
}
public static interface DoubleTriFunction {
R apply(double a, double b, double c) throws E;
}
public static interface BooleanTriConsumer {
void accept(boolean a, boolean b, boolean c) throws E;
}
public static interface CharTriConsumer {
void accept(char a, char b, char c) throws E;
}
public static interface ByteTriConsumer {
void accept(byte a, byte b, byte c) throws E;
}
public static interface ShortTriConsumer {
void accept(short a, short b, short c) throws E;
}
public static interface IntTriConsumer {
void accept(int a, int b, int c) throws E;
}
public static interface LongTriConsumer {
void accept(long a, long b, long c) throws E;
}
public static interface FloatTriConsumer {
void accept(float a, float b, float c) throws E;
}
public static interface DoubleTriConsumer {
void accept(double a, double b, double c) throws E;
}
public static interface ObjBooleanConsumer {
void accept(T t, boolean value) throws E;
}
public static interface ObjCharConsumer {
void accept(T t, char value) throws E;
}
public static interface ObjByteConsumer {
void accept(T t, byte value) throws E;
}
public static interface ObjShortConsumer {
void accept(T t, short value) throws E;
}
public static interface ObjIntConsumer {
void accept(T t, int value) throws E;
}
public static interface ObjLongConsumer {
void accept(T t, long value) throws E;
}
public static interface ObjFloatConsumer {
void accept(T t, float value) throws E;
}
public static interface ObjDoubleConsumer {
void accept(T t, double value) throws E;
}
public static final class EE {
private EE() {
// Singleton. Utility class.
}
public static interface Runnable {
void run() throws E, E2;
}
public static interface Callable extends java.util.concurrent.Callable {
@Override
R call() throws E, E2;
}
public static interface Supplier {
T get() throws E, E2;
}
public static interface Predicate {
boolean test(T t) throws E, E2;
}
public static interface BiPredicate {
boolean test(T t, U u) throws E, E2;
}
public static interface TriPredicate {
boolean test(A a, B b, C c) throws E, E2;
}
public static interface Function {
R apply(T t) throws E, E2;
}
public static interface BiFunction {
R apply(T t, U u) throws E, E2;
}
public static interface TriFunction {
R apply(A a, B b, C c) throws E, E2;
}
public static interface Consumer {
void accept(T t) throws E, E2;
}
public static interface BiConsumer {
void accept(T t, U u) throws E, E2;
}
public static interface TriConsumer {
void accept(A a, B b, C c) throws E, E2;
}
}
public static final class EEE {
private EEE() {
// Singleton. Utility class.
}
public static interface Runnable {
void run() throws E, E2, E3;
}
public static interface Callable extends java.util.concurrent.Callable {
@Override
R call() throws E, E2, E3;
}
public static interface Supplier {
T get() throws E, E2, E3;
}
public static interface Predicate {
boolean test(T t) throws E, E2, E3;
}
public static interface BiPredicate {
boolean test(T t, U u) throws E, E2, E3;
}
public static interface TriPredicate {
boolean test(A a, B b, C c) throws E, E2, E3;
}
public static interface Function {
R apply(T t) throws E, E2, E3;
}
public static interface BiFunction {
R apply(T t, U u) throws E, E2, E3;
}
public static interface TriFunction {
R apply(A a, B b, C c) throws E, E2, E3;
}
public static interface Consumer {
void accept(T t) throws E, E2, E3;
}
public static interface BiConsumer {
void accept(T t, U u) throws E, E2, E3;
}
public static interface TriConsumer {
void accept(A a, B b, C c) throws E, E2, E3;
}
}
}