Some refactoring in pandalib-util
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A consumer that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface BiConsumerException<T, U, E extends Exception> {
|
||||
/**
|
||||
* Run the consumer on the specified parameters.
|
||||
*
|
||||
* @param t the first parameter of the consumer.
|
||||
* @param u the second parameter of the consumer.
|
||||
* @throws E if the function fails.
|
||||
*/
|
||||
void accept(T t, U u) throws E;
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A predicate that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface PredicateException<T, E extends Exception> {
|
||||
/**
|
||||
* Test the predicate on the specified value.
|
||||
*
|
||||
* @param value the value to test against.
|
||||
* @return the result of the test.
|
||||
* @throws E if implementation failed to run.
|
||||
*/
|
||||
boolean test(T value) throws E;
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A runnable that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RunnableException<E extends Exception> {
|
||||
/**
|
||||
* Run any code implemented.
|
||||
*
|
||||
* @throws E if implementation failed to run.
|
||||
*/
|
||||
void run() throws E;
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A supplier that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SupplierException<T, E extends Exception> {
|
||||
/**
|
||||
* Gets a result.
|
||||
*
|
||||
* @return a result.
|
||||
* @throws E if implementation failed to run.
|
||||
*/
|
||||
T get() throws E;
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A function that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToIntBiFunctionException<T, U, E extends Exception> {
|
||||
/**
|
||||
* Run on the specified parameters to return an int value.
|
||||
*
|
||||
* @param t the first parameter of the function.
|
||||
* @param u the second parameter of the function.
|
||||
* @return the result of the function.
|
||||
* @throws E if the function fails.
|
||||
*/
|
||||
int applyAsInt(T t, U u) throws E;
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package fr.pandacube.lib.util.function;
|
||||
|
||||
/**
|
||||
* A consumer that can possibly throw a checked exception.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TriConsumerException<T, U, V, E extends Exception> {
|
||||
/**
|
||||
* Run the consumer on the specified parameters.
|
||||
*
|
||||
* @param t the first parameter of the consumer.
|
||||
* @param u the second parameter of the consumer.
|
||||
* @param v the third parameter of the consumer.
|
||||
* @throws E if the function fails.
|
||||
*/
|
||||
void accept(T t, U u, V v) throws E;
|
||||
}
|
Reference in New Issue
Block a user