This has caught me by surprise. After studying the Kotlin language to learn about how to best leverage this interesting new language for jOOQ, I stumbled upon this puzzler. What do you think the following program will print? fun main(args: Array) { (1..5).forEach { if (it == 3) return print(it) } print("done") } Well... You … Continue reading A Very Peculiar, but Possibly Cunning Kotlin Language Feature
Tag: lambda
Java 8 Friday Goodies: SQL ResultSet Streams
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. We have blogged a couple of times about some nice Java 8 goodies, and now we feel it's time to start a new blog series, the... … Continue reading Java 8 Friday Goodies: SQL ResultSet Streams
Java 8 Friday Goodies: Map Enhancements
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. We have blogged a couple of times about some nice Java 8 goodies, and now we feel it's time to start a new blog series, the... … Continue reading Java 8 Friday Goodies: Map Enhancements
A Lesser-Known Java 8 Feature: Generalized Target-Type Inference
Going through the list of Java 8 features, Generalized Target-Type Inference struck me as a particularly interesting, lesser-known gem. It looks as though the Java language designers will ease some of the pain that we've been having with generics in the past (Java 5-7). Let's have a look at their example: class List<E> { static … Continue reading A Lesser-Known Java 8 Feature: Generalized Target-Type Inference
Brian Goetz’s Final State of the Lambda Documentation
This week, Brian Goetz has published the final State of the Lambda documentation, which can be seen here: State of the Lambda State of the Lambda: Libraries Edition These are exciting times in Java, as Java 8's most impactful project has finally stabilised and can be downloaded here: JDK8 Developer Preview
Fast File System Operations with Xtend, Lambdas, and ThreadPools
Recently, I've blogged about 10 Subtle Best Practices when Coding Java, and I have mentioned that you should start writing SAMs (Single Abstract Method) now, in order to be prepared for Java 8. But there's another language gem out there, which comes in handy every once in a while, and that's Eclipse Xtend. Xtend is a … Continue reading Fast File System Operations with Xtend, Lambdas, and ThreadPools
10 Subtle Best Practices when Coding Java
This is a list of 10 best practices that are more subtle than your average Josh Bloch Effective Java rule. While Josh Bloch's list is very easy to learn and concerns everyday situations, this list here contains less common situations involving API / SPI design that may have a big effect nontheless. I have encountered … Continue reading 10 Subtle Best Practices when Coding Java
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
Exciting ideas in Java 8: Streams
Brian Goetz's recent post on the State of the Lambda reveils exciting new ideas that are prone to be included in Java 8. One of them is the concept of "Streams" as opposed to "Collections". Using the new Java 8 extension methods, the Iterable interface can be extended compatibly with a lot of "lazy" and … Continue reading Exciting ideas in Java 8: Streams