Skip to content

Tag: java-8

Stream non terminal operation + filter + findFirst

I’m trying to understand how the non-terminal streams operations are invoked. This seems clear for me. The first stream is not ended with terminal operation, so it doesn’t invoke the non-terminal operation and nothing is printed. The second one has terminal operation, so all the elements are print…

Runnable interface instantiation

I am following the book Head first java and was reading about threads and came to know about the Runnable interface. Now we know an interface can’t be instantiated directly. Its members are implemented by any class that implements the interface , but below code made bouncers over my head. The book decla…

Convert date format in springboot using java8

I receive the following date format How can I convert it into the following format in java 8 Answer You can use Java 8’s date/time API, and more precisely the DateTimeFormatter. There’s no pre-defined formatter that matches your initial input. The closest is DateTimeFormatter.RFC_1123_DATE_TIME, b…