Refactoring functional code
Refactoring code is the process of reworking the code to improve its readability and the maintainability of the program. In this section, we will examine the refactoring support provided by NetBeans and Eclipse. This support can be categorized as follows:
Converting anonymous inner classes to lambda expressions
Refactoring multiple instances of code
Miscellaneous refactoring support
In Chapter 2, Putting the Function in Functional Programming, we demonstrated how to convert the following anonymous inner class to a lambda expression:
List<String> list = Arrays.asList("Huey", "Dewey", "Louie"); list.forEach(new Consumer<String>() { @Override public void accept(String t) { System.out.println(t); } });
We will use this example to demonstrate refactoring.
NetBeans support for refactoring
We will examine how refactoring can be achieved in NetBeans. This IDE provides the basic functionality needed for most of the common...