I have a method from library, which look like this:
<T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
And EntryProcessor
interface has a single method definition:
T process(MutableEntry<K, V> entry, Object... arguments) throws EntryProcessorException;
Unfortunately for my use case I need EntryProcessor
with Serializable
.
One solution is to make a new class implementing both EntryProcessor
and Serializable
, in that case I would have to create a different class for each different use case.
Normally, without Serializable
, I can call invoke
method as a lambda, which saves me from creating pack of specialized classes.
foo.invoke(1L, (entry, arguments) -> {
...
return null;
});
Is there a way to extend this lambda with Serializable
interface?