D
D
Dmitry072016-07-29 16:17:03
Java
Dmitry07, 2016-07-29 16:17:03

How to use lambda expression for 'multi-method' interfaces?

Good day.
There is a main() method within which the run() method is called:

public static void main(String args[]) {
        EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new WorkTable().setVisible(true);
            }
        });
    }

NetBeans suggested replacing the anonymous class with a lambda expression:
public static void main(String args[]) {
       EventQueue.invokeLater(() -> {
            new WorkTable().setVisible(true);
        });
    }

Since the run() method is the only one in the Runnable interface, we are talking about its implementation. But how, in this case, to use a lambda expression if the interface has several methods (for example, List)?
Thanks to.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question