Home » Tag Archives: Java 8 (page 6)

Tag Archives: Java 8

Java 8 Lambda Expressions Tutorial

Greetings! :) After a few months away I decided to come back in style :). I noticed that one of my previous posts about the new Date/Time API got really popular, so this time I’m going to dedicate this post to another new feature of Java 8: Lambda Expressions. Functional Programming Lambda Expressions are the way by which the Java ...

Read More »

JDK 8 Streams and Grouping

I wrote about the powerful features of using JDK 8‘s Streams with Java collections in the post Stream-Powered Collections Functionality in JDK 8. I did not cover use of the groupingBy Collector reduction operation in that post and so address grouping in this post. The examples in this post will demonstrate how to combine Collection-backed Streams with groupingBy Collectors to ...

Read More »

Walking Recursive Data Structures Using Java 8 Streams

The Streams API is a real gem in Java 8, and I keep finding more or less unexpected uses for them. I recently wrote about using them as ForkJoinPool facade. Here’s another interesting example: Walking recursive data structures. Without much ado, have a look at the code:             class Tree { private int value; private ...

Read More »

Mapreduce in Java8

Wordcount is to Mapreduce what “Hello world” is for rest of the programming world. Recently I have been exploring some of the more prominent Java 8’s features like Lambda, Streams and Optionals, so I thought it’d be nice to do a simplified version of Wordcount in Java. Java’s Stream and Lambda functions makes it really easy and concise to implement ...

Read More »

Using Java 8 Lambda expressions in Java 7 or older

I think nobody declines the usefulness of Lambda expressions, introduced by Java 8. However, many projects are stuck with Java 7 or even older versions. Upgrading can be time consuming and costly. If third party components are incompatible with Java 8 upgrading might not be possible at all. Besides that, the whole Android platform is stuck on Java 6 and ...

Read More »

Joining Strings in JDK 8

JDK 8 introduced language features such as lambda expressions, streams, and even the new Date/Time API that will change the way we write Java applications. However, there are also several new APIs and features that might be less “game changing,” but still bring greater convenience and expressiveness to the Java programming language. In this post, I look at one of ...

Read More »

Java 8 pitfall – Beware of Files.lines()

There’s a really nice new feature in Java8 which allows you to get a stream of Strings from a file in a one liner.                   List lines = Files.lines(path).collect(Collectors.toList()); You can manipulate the Stream as you would with any other Stream for example you might want to filter() or map() or limit() ...

Read More »

Value-Based Classes

In Java 8 some classes got a small note in Javadoc stating they are value-based classes. This includes a link to a short explanation and some limitations about what not to do with them. This is easily overlooked and if you do that, it will likely break your code in subtle ways in future Java releases. To prevent that I ...

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