VIN
- The type of the function parameter, or Void
if the
function does not expect a parameter.VOUT
- The type of the function result, or Void
if the function
does not return anything (i.e. it only has side-effects).E
- The type of the exception thrown by the function, or
NeverThrowsException
if no exception is thrown by the
function.@FunctionalInterface public interface Function<VIN,VOUT,E extends Exception>
Exception handling: implementations which do not throw any exceptions
should declare that they throw an exception of type
NeverThrowsException
.
Example usage:
public class IsPossiblePrime implements Function<String, Boolean, IllegalArgumentException> { public Boolean apply(String value) throws IllegalArgumentException { // Parse the parameter now and potentially immediately throw an // exception. final BigInteger possiblePrime = new BigInteger(value); // Determine if the parameter is a prime number. return possiblePrime.isProbablePrime(1000); } }
AsyncFunction
,
NeverThrowsException
Modifier and Type | Method and Description |
---|---|
VOUT |
apply(VIN value)
Applies this function to the input parameter
value and returns
the result. |
Copyright 2010-2022 ForgeRock AS.