I have been using java lambdas in place of normal inline declarations in our java ui code thinking that it is just shorter and more concise syntax. But have not seen any specs indicating this and the aws lambda service seems to dominate the search results.
I came across this site which shows how much underlying provision javac puts into a lambda declaration and would like to know if I am actually adversely affecting runtime or memory usage performance in anyway for using java lambda syntax over the pre-lambda approach when doing inline calls.
Our implementation uses jre 8.
For example using:
final ActionListener cancelButtonListener = (final ActionEvent ae) -> {
// implementation w references to static or parent class member. ae argument is not referenced.
};
instead of
final ActionListener cancelButtonListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
// implementation w references to static or parent class member. ae argument is not referenced.
}
};
and
SwingUtilities.invokeLater(() -> {
// implementation w references to static or parent class member.
});
instead of
StringUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// implementation w references to static or parent class member.
}
});
Found a related post here. Also have found indicators that some lambdas will be compiled into byte code at runtime. I feel like my inline to lambda conversion should not affect performance would like to know what this community thinks.