common-utils/src/main/java/org/warp/commonutils/functional/CancellableFunction.java

16 lines
397 B
Java

package org.warp.commonutils.functional;
public interface CancellableFunction<T, U> { //extends Function<T, U> {
OperationResult<U> applyCancellable(T t);
/*default U apply(T t) {
var result = applyCancellable(t);
if (result == OperationResult.CANCEL) {
throw new UnsupportedOperationException("Can't cancel this operation");
}
//noinspection unchecked
return (U) result;
}*/
}