Top "Java-8" questions

Use this tag for questions specific to Java 8 which is version 8 (internal number 1.8) of the Java platform, released on 18 March 2014.

Collectors.toMap() keyMapper -- more succinct expression?

I'm trying to come up with a more succinct expression for the "keyMapper" function parameter in the following Collectors.toMap() …

java collections lambda java-8 java-stream
How can I create a Java 8 LocalDate from a long Epoch time in Milliseconds?

I have an external API that returns me dates as longs, represented as milliseconds since the beginning of the Epoch. …

java datetime java-8 java-time
Proper usage of Optional.ifPresent()

I am trying to understand the ifPresent() method of the Optional API in Java 8. I have simple logic: Optional<…

java lambda java-8 optional
How to add elements of a Java8 stream into an existing List

Javadoc of Collector shows how to collect elements of a stream into a new List. Is there an one-liner that …

java java-8 java-stream collectors
Registry key Error: Java version has value '1.8', but '1.7' is required

While running sencha app build production I am getting the following error: Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\…

java java-8 sencha-touch sencha-touch-2 sencha-cmd
Java 8 stream reverse order

General question: What's the proper way to reverse a stream? Assuming that we don't know what type of elements that …

java list sorting java-8 java-stream
Custom thread pool in Java 8 parallel stream

Is it possible to specify a custom thread pool for Java 8 parallel stream? I can not find it anywhere. Imagine …

java concurrency parallel-processing java-8 java-stream
Java 8 Streams: multiple filters vs. complex condition

Sometimes you want to filter a Stream with more than one condition: myList.stream().filter(x -> x.size() &…

java lambda filter java-8 java-stream
Java 8 Stream and operation on arrays

I have just discovered the new Java 8 stream capabilities. Coming from Python, I was wondering if there was now a …

java arrays java-8 java-stream
Java8: HashMap<X, Y> to HashMap<X, Z> using Stream / Map-Reduce / Collector

I know how to "transform" a simple Java List from Y -> Z, i.e.: List<String> …

java mapreduce java-8 java-stream collectors