/images/avatar.png

Welcome

My blog about programming, computer science, and other stuff.

Everything here is my personal opinion and is not related in any way to my current, past, or future employers.

Functional Java I - Single Method Interfaces

Java introduced functional programming features some time ago. In fact, it is nearly 7.5 years ago that Java 8 was released with it. And it took me only a bit over a year to write about it in my blog post called Functional Java. The other day, I noticed that a colleague was not aware of some not so obvious way Java treats lambdas (for an explanation of lambdas, see What are lambdas).

The Trolley Problem is a Red Herring

I wrote this in March 2018, but for some reason never published it. Back then, there was an ethics debate based on the trolley problem. If I remember correctly, this was triggered by by MIT’s Moral Machine. Example scenario from MIT's Moral Machine For a while, the media loved to discuss the trolley problem for self driving vehicles. Finally these thought experiments for theoretical ethics could be applied to something practical.

Stream.forEach() overuse

Starting with Java 8, Java programmers can enjoy the merrits of functional programming thanks to lambdas, java.util.function.* and the stream API. This is great, and allows to improve readability. For example, conversions of lists can be written in a relatively succint way: List<String> hosts = urls.stream().map(URL::getHost).collect(Collectors.toList())); That is much nicer and easier (or at least faster) to read than this: List<String> hosts = new ArrayList<>(urls.size()); for (final URL url : urls) { hosts.

Caraway Soaker Sourdough Bread

What I like about old bread soakers is that they are a good way to get water into the bread and that I can recycle some old bread that I have left over. I based this bread on the Rauriser Weizensauerteigbrot from Plötzblog. I added a soaker using toasted slices from a previous attempt to make the Rauriser Weizensauerteigbrot. While preparing the soaker I remembered that I have caraway. My previous attempt to use caraway in a bread was a bit disappointing.

Bagel Sourdough Bread

I wanted to toast a frozen bagel in the oven, but forgot it. So I got a bagel that was a bit too dark and dry. Hence, I decided to use it as a soaker for a rye/wheat bread. The result was a flavorful bread with compact crumb. Unfortunately, I only documented a part of the baking process. This recipe is a rough approximation of what I did.

Reversing a Linked List

Linked lists are an important data structure and also a popular source of interview questions. Few programmers will actually have to do a fully fledged linked list since most programming languages come with an implementation of it (usually of doubly linked lists). Nonetheless, understanding linked lists and other data structure will help you better understand runtime consequences of choosing one data structure over another. Reversing a linked list is a common task.