4 ms·
It's a tad more verbose, but I assume the simplest way would just be to use a standard closure. void log(Supplier<? extends String> messageSupplier);
by lazulicurio 4y ago
It's a tad more verbose, but I assume the simplest way would just be to use a standard closure.
void log(Supplier<? extends String> messageSupplier);
log(() -> log.info"User is \{someExpensiveFunction(user)}");
The pattern of using Supplier to provide a lazy argument is pretty well-established afaict.