Class Functions

java.lang.Object
org.tquadrat.foundation.function.Functions

@UtilityClass @ClassVersion(sourceVersion="$Id: Functions.java 1163 2026-03-20 15:28:33Z tquadrat $") public final class Functions extends Object

Some helper methods for the use with lambdas and functional interfaces.

TCE Wrapper

The methods of the functional interfaces in the package java.util.function do not declare any checked exceptions - for good reasons, of course. But sometimes, it would be nice to have that capability.

Using the wrapper methods in this class, you can achieve that like this:

…
import static org.tquadrat.foundation.function.Functions.*;
…

…
Appendable appendable = …
Consumer appender = wrapConsumer( s -> appendable.append( s ) );
…

…
try
{
  appender.accept( "…" );
}
catch( LambdaContainerException e )
{
  throw (IOException) e.getCause();
}
…

"TCE" stands for "Throws Checked Exception".

Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: Functions.java 1163 2026-03-20 15:28:33Z tquadrat $
Since:
0.0.5
UML Diagram
UML Diagram for "org.tquadrat.foundation.function.Functions"

UML Diagram for "org.tquadrat.foundation.function.Functions"

UML Diagram for "org.tquadrat.foundation.function.Functions"