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 … Continue reading Using Oracle AQ via Java 8 Streams
Tag: Java 8
How to Pattern-Match Files and Display Adjacent Lines in Java
Recently, we've published our article about the awesome window function support in jOOλ 0.9.9, which I believe is some of the best additions to the library that we've ever done. Today, we'll look into an awesome application of window functions in a use-case that is inspired by this Stack Overflow question Sean Nguyen: How to … Continue reading How to Pattern-Match Files and Display Adjacent Lines in Java
Use JUnit’s expected exceptions sparingly
Sometimes, when we get pull requests for jOOQ or our other libraries, people change the code in our unit tests to be more "idiomatic JUnit". In particular, this means that they tend to change this (admittedly not so pretty code): @Test public void testValueOfIntInvalid() { try { ubyte((UByte.MIN_VALUE) - 1); fail(); } catch (NumberFormatException e) … Continue reading Use JUnit’s expected exceptions sparingly
2016 Will be the Year Remembered as When Java Finally Had Window Functions!
You heard right. Up until now, the awesome window functions were a feature uniquely reserved to SQL. Even sophisticated functional programming languages still seem to lack this beautiful functionality (correct me if I'm wrong, Haskell folks). We've written tons of blog posts about window functions, evangelising them to our audience, in articles like: Probably the … Continue reading 2016 Will be the Year Remembered as When Java Finally Had Window Functions!
3 Reasons why You Shouldn’t Replace Your for-loops by Stream.forEach()
Awesome! We're migrating our code base to Java 8. We'll replace everything by functions. Throw out design patterns. Remove object orientation. Right! Let's go! Wait a minute Java 8 has been out for over a year now, and the thrill has gone back to day-to-day business. A non-representative study executed by baeldung.com from May 2015 … Continue reading 3 Reasons why You Shouldn’t Replace Your for-loops by Stream.forEach()
A Subtle AutoCloseable Contract Change Between Java 7 and Java 8
A nice feature of the Java 7 try-with-resources statement and the AutoCloseable type that was introduced to work with this statement is the fact that static code analysis tools can detect resource leaks. For instance, Eclipse: When you have the above configuration and you try running the following program, you'll get three warnings: public static … Continue reading A Subtle AutoCloseable Contract Change Between Java 7 and Java 8
The Danger of Subtype Polymorphism Applied to Tuples
Java 8 has lambdas and streams, but no tuples, which is a shame. This is why we have implemented tuples in jOOλ - Java 8's missing parts. Tuples are really boring value type containers. Essentially, they're just an enumeration of types like these: public class Tuple2<T1, T2> { public final T1 v1; public final T2 … Continue reading The Danger of Subtype Polymorphism Applied to Tuples
Comparing Imperative and Functional Algorithms in Java 8
Mario Fusco's popular tweet impressively shows what the main difference between imperative and functional approaches to similar algorithms really is: https://twitter.com/mariofusco/status/571999216039542784 Both algorithms do the same thing, they're probably equally fast and reasonable. Yet, one of the algorithms is much easier to write and read than the other. The difference lies in the fact that … Continue reading Comparing Imperative and Functional Algorithms in Java 8
How to use Java 8 Functional Programming to Generate an Alphabetic Sequence
I've stumbled upon an interesting Stack Overflow question by user "mip". The question was: I'm looking for a way of generating an alphabetic sequence: A, B, C, ..., Z, AA, AB, AC, ..., ZZ. This can be quickly recognised as the headings of an Excel spreadsheet, which does precisely that: . So far, none of … Continue reading How to use Java 8 Functional Programming to Generate an Alphabetic Sequence
Divided we Stand: Optional
Our recent article "NULL is Not The Billion Dollar Mistake. A Counter-Rant" got us a lot of reads, controversial comments, and a 50/50 upvote / downvote ratio pretty much everywhere a blog post can be posted and voted on. This was expected. Objectively, NULL is just a "special" value that has been implemented in a … Continue reading Divided we Stand: Optional
