Home » JVM Languages

JVM Languages

Validation in Kotlin: Valiktor

Bean Validation is the Java standard for validation and can be used in Kotlin as well. However, there are also two popular alternative libraries for validation available in Kotlin: Konform and Valiktor. Both implement validation in a more kotlin-like way without annotations. In this post we will look at Valiktor. Getting started with Valiktor First we need to add the ...

Read More »

Getting started with Ktor

Ktor (pronounced kay-tor) is an open source Kotlin framework for building asynchronous web applications. This post shows how to create a small RESTful CRUD service with Ktor. Getting started In this example we use Maven as build tool. Besides standard Kotlin dependencies we need to add the Ktor dependencies to our pom.xml: 01 02 03 04 05 06 07 08 ...

Read More »

Kotlin / IntelliJ quick hint: Operator navigation

This is just a quick hint if you are programming Kotlin with IntelliJ: In IntelliJ you can ctrl-click on operators to navigate to the operator definition (similar to ctrl-clicking on methods). This also works for the get operator (you can click on the [] brackets) and for ranges (you can click on the dots (..) between the start and end ...

Read More »

Kotlin infix functions

What are infix functions? If you are using Kotlin chances are high you already used infix functions. Maybe without knowing it. When calling infix functions it is possible to omit the dot and the parentheses. So instead of 1 car.move(forward) we can write: 1 car move forward Here are a few examples of commonly used infix functions in Kotlin. The ...

Read More »

Join Two Lists in Kotlin

A quick programming guide to join two lists in kotlin. Joining two lists or ArrayList can be done using List addAll() or apache commons ListUtils.union() method and show examples on each method. 1. Introduction In this article, You’ll learn how to join two lists in kotlin programming language. List api has addAll() method and apache ListUtils.union() method to add two ...

Read More »

Advanced Creation of Hamcrest Matchers in Kotlin

This article is a rewrite of an older one done in Java. This one is done in Kotlin instead. Intro Last time, I went over what a Hamcrest Matcher was, how it’s used, and how to make one. In this article, I will explain more advanced steps in the creation of Hamcrest Matchers. First, I’ll share how to make your ...

Read More »

How to Make Your Own Hamcrest Matchers in Kotlin

This article is a rewrite of an older one done in Java. This one is done in Kotlin instead. Intro to Hamcrest Matchers First things first, I should quickly explain what a Hamcrest Matcher is. When doing unit testing, the built-in assertion types that come with the testing framework are generally pretty limited. They make it very easy for a ...

Read More »

Scala Main class

Adding a main class is Scala is something that I always end up searching so next time it shall be through my blog. You can go for the extends App option One way is to add a main class by extending the App class. Everything else that get’s executed on that block is part of the “main” function. 1 2 ...

Read More »

Project reactor – de-structuring a Tuple


Tuples are simple data structures that hold a fixed set of items, each of a different data type. Project Reactor provides a Tuple data structure that can hold about 8 different types. Tuples are very useful, however one of the issues in using a Tuple is that it is difficult to make out what they hold without de-structuring them at ...

Read More »