Module com.machinezoo.noexception
    
    
    Interface OptionalToIntFunction<T>
- 
       
- Type Parameters:
 - 
         
T- seeToIntFunction 
- All Superinterfaces:
 - 
         
Function<T,OptionalInt> 
- Functional Interface:
 - This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
 
@FunctionalInterface public interface OptionalToIntFunction<T> extends Function<T,OptionalInt>
Variation ofToIntFunctionthat returnsOptionalIntinstead of the raw value.OptionalToIntFunctionis typically obtained fromExceptionHandler.fromToIntFunction(ToIntFunction), in which case its return value is empty when the underlyingToIntFunctionthrows an exception. See noexception tutorial. 
- 
       
-   
          
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description OptionalIntapply(T value)Variation ofToIntFunction.applyAsInt(Object)that returnsOptionalInt.default ToIntFunction<T>orElse(int result)Converts thisOptionalToIntFunctionto plainToIntFunctionusing default value.default ToIntFunction<T>orElseGet(IntSupplier source) 
 -   
          
 
- 
       
-   
          
Method Detail
- 
            
apply
OptionalInt apply(T value)
Variation ofToIntFunction.applyAsInt(Object)that returnsOptionalInt. If thisOptionalToIntFunctionis obtained fromExceptionHandler.fromToIntFunction(ToIntFunction), theOptionalIntwill be empty only if the underlyingToIntFunctionthrows. Otherwise the returnedOptionalIntjust wraps the return value of underlyingToIntFunction.- Specified by:
 - 
              
applyin interfaceFunction<T,OptionalInt> - Parameters:
 - 
              
value- seeToIntFunction.applyAsInt(Object) - Returns:
 - 
              
OptionalInttypically wrapping return value ofToIntFunction.applyAsInt(Object), or an emptyOptionalInt(typically signifying an exception) - See Also:
 - 
              
ExceptionHandler.fromToIntFunction(ToIntFunction),ToIntFunction.applyAsInt(Object) 
 
- 
            
orElse
default ToIntFunction<T> orElse(int result)
Converts thisOptionalToIntFunctionto plainToIntFunctionusing default value. The returnedToIntFunctionwill unwrap present value from theOptionalIntif possible, or returnresultif theOptionalIntis empty.- Parameters:
 - 
              
result- default value to return instead of an emptyOptionalInt - Returns:
 - 
              plain 
ToIntFunctionthat either unwrapsOptionalIntor returns default value - See Also:
 - 
              
orElseGet(IntSupplier),OptionalInt.orElse(int) 
 
- 
            
orElseGet
default ToIntFunction<T> orElseGet(IntSupplier source)
Converts thisOptionalToIntFunctionto plainToIntFunctionusing fallbackIntSupplier. The returnedToIntFunctionwill unwrap present value from theOptionalIntif possible, or fall back to callingsourceif theOptionalIntis empty.- Parameters:
 - 
              
source-IntSupplierto query for fallback value whenOptionalIntis empty - Returns:
 - 
              plain 
ToIntFunctionthat either unwrapsOptionalIntor falls back tosource - See Also:
 - 
              
orElse(int),OptionalInt.orElseGet(IntSupplier) 
 
 - 
            
 
 -