com.machinezoo.noexception.optional.FallbackLongUnaryOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of noexception Show documentation
Show all versions of noexception Show documentation
Functional programming for exception handlers.
// Part of NoException: https://noexception.machinezoo.com
package com.machinezoo.noexception.optional;
import java.util.function.*;
import lombok.*;
@RequiredArgsConstructor final class FallbackLongUnaryOperator implements LongUnaryOperator {
private final OptionalLongUnaryOperator inner;
private final LongSupplier source;
@Override public long applyAsLong(long operand) {
return inner.apply(operand).orElseGet(source);
}
}