How do I write the equivalent of a lambda expression in Java 1.7?

I have the following code in Java 1.8.

solver.plugMonitor((IMonitorSolution) () -> solution.record(solver));

      

How can I convert this to Java 1.7 code without lambda?

+3


source to share


1 answer


The method plugMonitor

requires a type argument IMonitorSolution

, with some method YMethod

that has no arguments:

solver.plugMonitor (new IMonitorSolution () {
                        public void YMethod () {
                            solution.record(solver);
                        }
                    });

      



Thanks @Boann for fixing my mistake.

+7


source







All Articles