Home » Tag Archives: Java 8

Tag Archives: Java 8

Functional Programming in Java 8 with Javaslang

java-logo

We’re very happy to announce a guest post on the jOOQ Blog written by Daniel Dietrich, Senior Software Engineer at HSH Nordbank, husband and father of three. He currently creates a pricing framework for financial products as project lead and lead developer. Besides his work, he is interested in programming languages, efficient algorithms and data structures. Daniel wrote the short ...

Read More »

Cheating with Exceptions – Java 8 Lambdas

java-logo

Cheating with Exceptions – Java 8 Lambdas Leaving aside the religious debate about Checked vs Runtime exceptions, there are times where due to poorly constructed libraries, dealing with checked examples can drive you insane. Consider this snippet of code which you might want to write: public void createTempFileForKey(String key) { Map<String, File> tempFiles = new ConcurrentHashMap<>(); //does not compile because ...

Read More »

JUnit: Testing Exceptions with Java 8 and AssertJ 3.0.0

junit-logo

AssertJ 3.0.0 release for Java 8 makes testing exceptions much easier than before. In one of my previous blog post I described how to utilize plain Java 8 to achieve this, but with AssertJ 3.0.0 much of the code I created may be removed. Warning: this blog post contains mostly the code examples.     SUT – System Under Test ...

Read More »

Using Rhino with Java 8

java-logo

Java brings Nashorn as new JavaScript implementation for JSR 223 (javax.scripting). While this is certainly great news (Nashorn is way faster than Rhino by directly generating Java code), it comes with some challenges: Nashorn is not 100% compatible with Rhino. Rhino had some extensions and more or less other interpretations on how to combine the Java world with JavaScript. Therefore ...

Read More »

The JDK 8 SummaryStatistics Classes

java-logo

Three of the new classes introduced in JDK 8 are DoubleSummaryStatistics, IntSummaryStatistics, and LongSummaryStatistics of the java.util package. These classes make quick and easy work of calculating total number of elements, minimum value of elements, maximum value of elements, average value of elements, and the sum of elements in a collection of doubles, integers, or longs. Each class’s class-level Javadoc ...

Read More »

How to FlatMap a JDBC ResultSet with Java 8?

java-interview-questions-answers

You’re not into the functional mood yet? Then the title might not resonate with you – but the article will! Trust me. Essentially, we want this: +------+------+------+ | col1 | col2 | col3 | +------+------+------+ | A | B | C | row 1 | D | E | F | row 2 | G | H | I | ...

Read More »

Java 8 Lambdas in One Line

java-logo

If you understand this line, or better still can write this code you can pretty much say that you have understood the essence of Java 8 Lambdas. Certainly in as much as they can be used with collections. I found this in a recent presentation by Peter Lawrey.  (Definitely worth watching the whole presentation when you have a spare hour.) Anyway ...

Read More »

How to Use Java 8 Streams to Swiftly Replace Elements in a List

java-logo

Imagine you have a list of items: List<String> books = Arrays.asList( "The Holy Cow: The Bovine Testament", "True Hip Hop", "Truth and Existence", "The Big Book of Green Design" ); (Don’t judge me. Books from this random book generator) Now you’d like to create a new list where the third item only is replaced by some new value: List<String> books ...

Read More »

Yet another Java 8 Lamdbas and Streams example

java-logo

I’ve been lagging behind with what Java 8 features exercising concerns, so in this post I will briefly present my initial experience with lambdas and streams. As usual, I will focus on a Podcast class:               package org.codingpedia.learning.java.core; import java.util.Comparator; public class Podcast { int id; String title; String producer; int subscriptionsNumber; /** number of ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close