...

/

Java 8 Cheat Sheet

Java 8 Cheat Sheet

Learn about Java syntax and methods.

Lambda syntax

Press + to interact
str -> System.out.println(str)
() -> System.out.println(this)
(String str) -> System.out.println(str)
(String s1, String s2) -> { return s2.length() - s1.length(); }
(s1, s2) -> s2.length() - s1.length()

Method References

Press + to interact
Function f = Object::toString
Supplier s = thing::toString
Stream<File> pdfs = getFiles().filter(FileFilters::fileIsPdf)

Functional interfaces under java.util.function

...
Access this course and 1400+ top-rated courses and projects.