The simplest way to start using them seems to apply Netbeans refactoring hints.
These hints are of two kinds for WorldClock:
- Iterations:
for (City city : cities)Java8:
{
city.paint(g, width, height, isFullScreen);
}
cities.stream().forEach((city) ->It may not bring much in this instance though.
{
city.paint(g, width, height, isFullScreen);
});
- Single method anonymous inner classes:
mnuiShow.addActionListener(new ActionListener()Java8:
{
@Override
public void actionPerformed(ActionEvent e)
{
showWindow();
}
});
mnuiShow.addActionListener((ActionEvent e) ->There it does reduce the boiler plate code.
{
showWindow();
});
No comments:
Post a Comment