Java 8’s Method References Put Further Restrictions on Overloading

Method overloading has always been a topic with mixed feelings. We've blogged about it and the caveats that it introduces a couple of times: You Will Regret Applying Overloading with Lambdas! Keeping things DRY: Method overloading Why Everyone Hates Operator Overloading API Designers, be Careful There are two main reasons why overloading is useful: To … Continue reading Java 8’s Method References Put Further Restrictions on Overloading

We’re Taking Bets: This Annotation Will Soon Show up in the JDK

This recent Stack Overflow question by Yahor has intrigued me: How to ensure at Java 8 compile time that a method signature “implements” a functional interface. It's a very good question. Let's assume the following nominal type: @FunctionalInterface interface LongHasher { int hash(long x); } The type imposes a crystal clear contract. Implementors must provide … Continue reading We’re Taking Bets: This Annotation Will Soon Show up in the JDK

Java 8 Friday: The Best Java 8 Resources – Your Weekend is Booked

At Data Geekery, we love Java. And as we're really into jOOQ's fluent API and query DSL, we're absolutely thrilled about what Java 8 will bring to our ecosystem. Every Friday, we're showing you a couple of nice new tutorial-style Java 8 features, which take advantage of lambda expressions, method references, default methods, the Streams … Continue reading Java 8 Friday: The Best Java 8 Resources – Your Weekend is Booked

JDK 8: State of the Collections

Here's the latest publication by Brian Goetz, Oracle's project lead for JSR 335, a.k.a. Project Lambda. Here's a nice example showing new collection features, such as "Streams" using method references: List<String> strings = ... int sumOfLengths = strings.stream() .map(String::length) .reduce(0, Integer::plus); Another nice example showing the use of lambda expressions: int sum = shapes.stream() .filter(s … Continue reading JDK 8: State of the Collections