Top Description Methods
io.vavr

public Interface CheckedRunnable

Additional top-level class in compilation unit: CheckedRunnableModule.

Annotations
@FunctionalInterface
Static Imports
io.vavr.CheckedRunnableModule.sneakyThrow

A Runnable which may throw.

Method Summary

Modifier and TypeMethod and Description
public static CheckedRunnable

Returns:

a new CheckedRunnable
of
(CheckedRunnable
(typically) a method reference, e.g. Type::method
methodReference
)

Creates a CheckedRunnable.

public void
run()

Performs side-effects.

public default Runnable

Returns:

a new Runnable that throws a Throwable.
unchecked
()

Returns an unchecked Runnable that will sneaky throw if an exceptions occurs when running the unit of work.

Method Detail

ofback to summary
public static CheckedRunnable of(CheckedRunnable methodReference)

Creates a CheckedRunnable.

// class Evil { static void sideEffect() { ... } }
final CheckedRunnable checkedRunnable = CheckedRunnable.of(Evil::sideEffect);
final Runnable runnable = checkedRunnable.unchecked();

// may or may not perform a side-effect while not throwing
runnable.run();

// may or may not perform a side-effect while throwing
runnable.run();
Parameters
methodReference:CheckedRunnable

(typically) a method reference, e.g. Type::method

Returns:CheckedRunnable

a new CheckedRunnable

See Also
CheckedFunction1#of(CheckedFunction1)
runback to summary
public void run() throws Throwable

Performs side-effects.

Exceptions
Throwable:
if an error occurs
uncheckedback to summary
public default Runnable unchecked()

Returns an unchecked Runnable that will sneaky throw if an exceptions occurs when running the unit of work.

Returns:Runnable

a new Runnable that throws a Throwable.