With Java 8 being mainstream now, people start using Streams for everything, even in cases where that's a bit exaggerated (a.k.a. completely nuts, if you were expecting a hyperbole here). For instance, take mykong's article here, showing how to collect a Map's entry set stream into a list of keys and a list of values: … Continue reading Using jOOλ to Combine Several Java 8 Collectors into One
Tag: tuples
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
A Typesafety Comparison of SQL Access APIs
SQL is a very expressive and distinct language. It is one of the few declarative languages which are used by a broad audience in everyday work. As a declarative language, SQL allows to specify what we're expecting as output, not how this output should be produced. As a side-effect of this, ad-hoc record data types … Continue reading A Typesafety Comparison of SQL Access APIs
Row value expressions and the BETWEEN predicate
Now this is a simple example of how SQL clause simulation can get nasty if you want to make use of some more advanced SQL clauses that aren't supported in all databases. Consider the following predicate and equivalent transformations thereof: The BETWEEN predicate The BETWEEN predicate is a convenient form of expressing the fact that … Continue reading Row value expressions and the BETWEEN predicate
Row value expressions and the NULL predicate
Row value expressions are something very powerful in SQL. They have been around since the early days of standard SQL, e.g. in SQL 1992, even if not all databases implement them correctly, still today. As always, the NULL predicate is one that is a bit tricky to understand, also in the context of row value … Continue reading Row value expressions and the NULL predicate
Array, list, set, map, tuple, record literals in Java
Occasionally, when I'm thrilled by the power and expressiveness of JavaScript, I find myself missing one or two features in the Java world. Apart from lambda expressions / closures or whatever you want to call "anonymous functions", it's the use of advanced literals for common data types, such as arrays, lists, sets, maps, etc. In … Continue reading Array, list, set, map, tuple, record literals in Java