Home » Tag Archives: Java 8 (page 4)

Tag Archives: Java 8

Everything You Need To Know About Default Methods

java-logo

So, default methods… yesterday’s news, right? Yes but after a year of use, a lot of facts accumulated and I wanted to gather them in one place for those developers who are just starting to use them. And maybe even the experienced ones can find a detail or two they didn’t know about yet. I will extend this post in ...

Read More »

Reason for Slower Reading of Large Lines in JDK 7 and JDK 8

java-logo

I earlier posted the blog post Reading Large Lines Slower in JDK 7 and JDK 8 and there were some useful comments on the post describing the issue. This post provides more explanation regarding why the file reading demonstrated in that post (and used by Ant‘s LineContainsRegExp) is so much slower in Java 7 and Java 8 than in Java ...

Read More »

Java8 Lambdas: Sorting Performance Pitfall EXPLAINED

java-logo

Written in collaboration with Peter Lawrey. A few days ago I raised a serious problem with the performance of sorting using the new Java8 declarative style. See blogpost here.  In that post I only pointed out the issue but in this post I’m going to go a bit deeper into understanding and explaining the causes of the problem.  This will ...

Read More »

How to Translate SQL GROUP BY and Aggregations to Java 8

java-logo

I couldn’t resist. I have read this question by Hugo Prudente on Stack Overflow. And I knew there had to be a better way than what the JDK has to offer. The question reads:               I’m looking for a lambda to refine the data already retrieved. I have a raw resultset, if the user ...

Read More »

The Decorator Pattern With Java 8

java-design-patterns-logo_scaled

In a recent post I described how the decorator pattern saved my day. I gave a small code snippet which contained the simplest way to create decorators but promised that there would be a nicer way with Java 8. Here it is:               Decorating With Java 8 HyperlinkListener listener = this::changeHtmlViewBackgroundColor; listener = DecoratingHyperlinkListener.from(listener) ...

Read More »

Java 8 Functional Programming: Lazy Instantiation

java-logo

Singletons often instantiate themselves lazily, and sometimes, if the object is heavy enough, class fields can be instantiated lazily. Generally, when going the lazy route, the getter method (or accessor) has to have a block of code that checks whether the object is instantiated yet (and, if it isn’t, it needs to be instantiated) before returning it. This check is ...

Read More »

Using Java 8 to Prevent Excessively Wide Logs

java-logo

Some logs are there to be consumed by machines and kept forever. Other logs are there just to debug and to be consumed by humans. In the latter case, you often want to make sure that you don’t produce too much logs, especially not too wide logs, as many editors and other tools have problems once line lenghts exceed a ...

Read More »

Java Lambdas and Low Latency

java-logo

Overview The main question around the use of Lambdas in Java and Low Latency is; Does they produce garbage and is there anything you can do about it? Background I am working on a library which supports different wire protocols. The idea being that you can describe the data you want to write/read and the wire protocol determines if it ...

Read More »

2015 Starts Off Strong for Java 8

java-logo

JDK 8 is starting 2015 with a surge in popularity in terms of blog posts and articles. This is coinciding with Java being automatically upgraded to JDK 8 this month. In this post, I list and briefly describe some of the numerous articles and posts on JDK 8 that have been published already in 2015. JDK 8 Streams have been ...

Read More »

Java8 Sorting – Performance Pitfall

java-logo

Java 8 brings all the goodness of lambdas to enable us to program using a declarative style. But is it really free? And should we be concerned about the price we have to pay for the new programming goodies? Here’s an example where we might have to worry. Consider sorting instances of this simple class:           ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.