Home » Tag Archives: Java 8 (page 2)

Tag Archives: Java 8

Grouping, transforming and reduction with Java 8

java-logo

1. Introduction In this previous post, I wrote about how we can group collections of objects with streams and grouping. This is useful but does not cover specific use cases. For example, sometimes we do not only need to group things but also transform the result into a more appropriate object. In this post, we will learn how to apply ...

Read More »

(Ab)using Java 8 FunctionalInterfaces as Local Methods

java-logo

If you’re programming in more advanced languages like Scala or Ceylon, or even JavaScript, “nested functions” or “local functions” are a very common idiom to you. For instance, you’ll write things like fibonacci functions as such: def f() = { def g() = "a string!" g() + "– says g" } (Question from Stack Overflow by Aaron Yodaiken) The f() ...

Read More »

Parsing Java 8 Streams Into SQL

java-logo

When Java 8 was released and people began streaming over all kinds of stuff, it didn’t take long before they started imagining how great it would be if you could work with your databases in the same way. Essentially relational databases are made up of huge chunks of data organized in table-like structures. These structures are ideal for filtering and ...

Read More »

Streaming over Maps with Java 8

java-logo

In this article I will show you how Speedment Open Source stream efficiently over standard Java maps, expanding the Stream interface into something called a MapStream! This addition will make it easier to keep your streams concrete and readable even in complex scenarios. Hopefully this will allow you to keep streaming without prematurely collecting the result. One of the largest ...

Read More »

Using Oracle AQ via Java 8 Streams

java-interview-questions-answers

One of the most awesome features of the Oracle database is Oracle AQ: Oracle Database Advanced Queuing. The AQ API implements a full fledged, transactional messaging system directly in the database. In a classic architecture where the database is at the center of your system, with multiple applications (some of which written in Java, others written in Perl or PL/SQL, ...

Read More »

Improved Documentation of HotSpot Options in Java 8

java-logo

One of the small but welcome features introduced with Oracle’s HotSpot implementation of Java 8 is the addition of many common HotSpot Java launcher (java) options/flags to the launcher’s documentation. In the past, a developer interested in even some fairly common HotSpot JVM options has had to potentially look in multiple different sources to find “official” documentation on these flags. ...

Read More »

Using Java 8 Lambdas, Streams, and Aggregates

java-logo

Overview In this post, we’ll take a look at filtering and manipulating objects in a Collection using Java 8 lambdas, streams, and aggregates. All code in this post is available in BitBucket here. For this example we’ll create a number of objects that represent servers in our IT infrastructure. We’ll add these objects to a List and then we’ll use ...

Read More »

Functional vs Imperative Programming. Fibonacci, Prime and Factorial in Java 8

java-logo

There are multiple programming styles/paradigms, but two well-known ones are Imperative and Functional. Imperative programming is the most dominant paradigm as nearly all mainstream languages (C++, Java, C#) have been promoting it. But in the last few years functional programming started to gain attention. One of the main driving factors is that simply all new computers are shipped with 4, ...

Read More »

Java 8 Lambda Expression for Design Patterns – Decorator Design Pattern

java-logo

The Decorator pattern (also known as Wrapper) allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class. It can be considered as an alternative to subclassing. We know that subclassing adds behavior at compile time and the change affects all instances of the original class. On ...

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