Skip to main content

Missing class in java.util.function

1 reply [Last post]
danieldietrich
Offline
Joined: 2014-01-10
Points: 0

Hi,

we need a

@FunctionalInterface
public interface Unit {
void sideEffects();
}

in the package java.util.function to create an abstraction of a block of code producing side-effects ...

EXAMPLE (informal):

jdbc.transaction( () -> {

// database update 1
jdbc.update(sql1);

// database update 2
jdbc.update(sql2);

// etc.

});

Regards,

Daniel

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
danieldietrich
Offline
Joined: 2014-01-10
Points: 0

Sorry for consuming your time. Of cause I should have looked elsewhere than in java.util.function for such a functional interface.

java.lang.Runnable does the job.