Quantcast
Browsing latest articles
Browse All 5 View Live

Examples of Constructor references in Java 8

In Java 8, referencing a constructor is exactly the same as referencing a static method, you can easily create a reference to a constructor by only using the “new” keyword:ClassName::newBasically,...

View Article


How to chain comparators in Java 8?

In this post we will see how we can chain comparators in Java 8. Let’s assume we have a list of vehicles with their weight and number of wheels they have, and we want to sort them by number of wheels...

View Article


Common functional interfaces in Java 8

First, let’s briefly describe what are functional interfaces in Java 8. A functional interface is an interface that has exactly one abstract method. In older Java version, you have seen several...

View Article

What is the difference between Collections and Streams in Java 8?

Let’s start by describing what a Stream is in Java 8. Streams let you manipulate collections of data without you explicitly iterating over them. In other words, a Stream is a sequence of elements from...

View Article

Calculating Sum, Avg, Min and Max of a List ( summaryStatistics ) in one...

In Java 8 it is really easy to calculate the Sum, Average, Minimum and Maximum of a list on integers in one single line. There is this newly added class called: IntSummaryStatistics which has the...

View Article

Browsing latest articles
Browse All 5 View Live