Home » Author Archives: Nicolai Parlog

Author Archives: Nicolai Parlog

Nicolai Parlog
Nicolai is a thirty year old boy, as the narrator would put it, who has found his passion in software development. He constantly reads, thinks, and writes about it, and codes for a living as well as for fun.Nicolai is the editor of SitePoint's Java channel, writes a book about Project Jigsaw, blogs about software development on codefx.org, and is a long-tail contributor to several open source projects. You can hire him for all kinds of things.

Repackaging Exceptions In Streams

Java 8 is a couple of years old but there are still use cases, not even edge cases, that the community did not yet develop a good arsenal of solutions for. How to handle checked exceptions in stream pipelines is one such problem. The functional interfaces various Stream operations accept do not allow implementations to throw checked exceptions but many ...

Read More »

Why Elvis Should Not Visit Java

I was recently involved in quite a long Twitter discussion regarding Java’s Optional, type systems that distinguish nullable and non-nullable types and the the Elvis operator, which allows null-safe member selection. The latter was peddled as a killer feature for succinct null-handling, which I strongly disagree with. My opinion on the matter is that without a type system that allows ...

Read More »

Publishing Snapshots With Gradle’s maven-publish Plugin

I’ve recently started a new project with Gradle and decided to jump straight in – no Gradle experience, no clue about Groovy, no tutorials, just hammer on it until it works. That went surprisingly well until I decided to publish snapshots to Sonatype’s Maven snapshot repository with the incubating maven-publish plugin – that took, ahh, a little convincing. Caveat: As ...

Read More »

What Future Java Might Look Like

During the second week of November was Devoxx Belgium, Europe’s biggest Java conference, and as every year the community’s who’s-who showed up. One of them was Brian Goetz, Java Language Architect at Oracle, and he gave what I would consider the conference’s most thrilling talk: “Java Language and Platform Futures: A Sneak Peek”. In it he presented ideas that the ...

Read More »

Rebutting 5 Common Stream Tropes

I’ve just finished reading “1 Exception To The Power of JDK 8 Collectors” and I have to say that I am pretty disappointed. Simon Ritter, Java champion, former Java evangelist at Oracle, and now Deputy CTO at Azul Systems (the guys with the cool JVM), wrote it so I expected some interesting insights into streams. Instead the post comes down ...

Read More »

JUnit 5 – Dynamic Tests

When it came to defining tests, JUnit 4 had a tremendous weakness: It had to happen at compile time. Now, JUnit 5 will fix this oversight! Milestone 1 just got released and it comes with the brand-new dynamic tests, which allow the creation of tests at run time. Overview Other posts in this series about JUnit 5: Setup Basics Architecture ...

Read More »

Java 9 Additions To Optional

Wow, people were really interested in Java 9’s additions to the Stream API. Want some more? Let’s look at …                   Optional Optional::stream This one requires no explanation: Stream<T> stream(); The first word that comes to mind is: finally! Finally can we easily get from a stream of optionals to a stream ...

Read More »

Java 9 Additions To Stream

Java 9 is coming! And it is more than just Project Jigsaw. (I was surprised, too.) It is bringing a lot of small and not-so-small changes to the platform and I’d like to look at them one by one. I’ll tag all these posts and you can find them here. Let’s start with … Streams Streams learned two new tricks. ...

Read More »

How To Implement hashCode Correctly

So you’ve decided that identity isn’t enough for you and wrote a nice equals implementation? Great! But now you have to implement hashCode as well. Let’s see why and how to do it correctly. Equality and Hash Code While equality makes sense from a general perspective, hash codes are much more technical. If we were being a little hard on ...

Read More »

How To Implement equals Correctly

A fundamental aspect of any Java class is its definition of equality. It is determined by a class’s equals method and there are a couple of things to be considered for a correct implementation. Let’s check ’em out so we get it right! Note that implementing equals always means that hashCode has to be implemented as well! We’ll cover that ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns