-
Java Resources
description here
-
Java 8 Cheatsheet
Java 8 Cheatsheet
Syntax for Java 8 lambda expressions:
Syntax: (parameters) -> expression
e.g. (int x, int y) -> x + y
Syntax: (parameters) -> statement
e.g. () -> System.out.println("hi " + s)...
-
About Java Resources
About Java Resources
This web site is focused on providing information about how to use the various features of Java 8, like streams, lambdas, default methods, etc.
This is NOT the official website of...
-
Filter Java 8 stream
Filter Java 8 stream
Let's filter a list of strings using Java 8 streams:
List<String> list = Arrays.asList("a", "", "b", "", "c");
// Count the non-empty strings
long nonEmptyCount = list.stream()
...
-
Distinct elements in Java 8 streams
Distinct elements in Java 8 streams
Finding the distinct elements of a Java stream is easy. We can use the
Stream#distinct method:
List<String> words = Arrays.asList("hello", "Java8", "world!", "hell...
-
Java 8 stream map
Java 8 stream map
Let's map a list of words using Java 8 streams:
List<String> words = Arrays.asList("A", "bbb", "CC", "dd");
// Map the words to UPPERCASE and join them with the ":" separator
String...