I tried to write a long article and couldn't write it forever, so I decided to write an article for myself. It may seem like it has already been written, but it is a memo for beginners.
It's easy to misunderstand that lambda expression = Java (personal prejudice). Let's run the background roughly.
It's just a list, so let's actually compare it.
** Method **
public class ThisIsSample {
int res;
private void calculate(int value1, int value2) {
res = value1 + value2;
}
}
** Anonymous class **
ThisIsSample printRunOut = new ThisIsSample() {
public void prt() {
System.out.println("sample");
}
};
printRunOut.prt();
** Lambda expression **
ThisIsSample printRunOut = () -> {
System.out.println("sample");
};
printRunOut.prt();
After all this alone is not clear. I understand that ** type inference ** restores the abbreviation, but I can't say I understand it. It seems that I have to practice it, but I can't compile it now. (?) So, I would like to describe it later.
Java functional interface * There is also a summary of lambda expressions. Basics of using Java8 lambda expressions [Java] Super introduction to Java 8 lambda (writing style, functional interface, unique definition, lambda receiving process)
** Addition ** Markdown Notation Cheat Sheet -Qiita List of things I did to write a document in Markdown -Qiita Qiita Markdown Notation List / Cheat Sheet -Qiita
I don't have time, so I'll give it a try ... I will fix it at a later date. (I don't know much about Stream yet)
2019.7.16 postscript Until now, I have nothing to do with the server system, and I have been playing with Excel / Access / VBA in a small office. The reason why Java is now is that by touching RPA composed of Java, I became familiar with the server-side system for the first time other than the Web. ~~ It's a sloppy article ~~, but please take a warm look.
Recommended Posts