Lambda
Self-contained and reusable sub-functions with special behaviour.
Lambdas are special 'sub-fuctions' that can be defined within code and executed when needed.
These are an advanced and complex feature, allowing for more dynamic code to be created.
Runnables
The runnable expression is a basic lambda, creating an executable object that can be passed to other functions and run when needed.
They can be passed to other functions as parameters or return values.
The variables used in a runnable are frozen. This means their values will not change once the runnable is created.
This allows the runnable to be passed to other functions without error, since the value is already saved.
Suppliers
Suppliers are an alternative to runnables that can return a value, so are more appropriate to use with the result of...
expression than the run
effect.
Like the runnable, the supplier section creates an executable object that can be passed to other functions.
Like runnables, suppliers have their variables frozen, so their values will not change after creation.
Last updated