Java Enhanced Switch

A switch statement allows the application to have multiple possible execution paths based on the value of a given expression in runtime. The evaluated expression is called the selector expression which must be of type char, byte, short, int, Character, Byte, Short, Integer, String, or an enum. In Java 14 a neat language feature was […]

Java Non-Denotable Types

You learn something new everyday as a programmer. Whilst reading a preview of The Well-Grounded Java Developer 2nd Edition (MEAP V02), I noticed something that looks like duck typing! This is referred to as a non-denotable type, it is inferred as the type of the expression that is assigned. In this case, the type is […]

Quick Sort in Java

This is a Java implementation of an earlier post named QuickSort in which I used Python. This version uses lists rather than arrays so it can be used to sort a list of any object that implements the Comparable interface. First the method which does the sorting: Followed by the main method: As per the […]

Selection Sort in Java

This is a Java implementation of a Selection Sort in Python from a previous post. I like the selection sort because it is simple, but it is not the most efficient. I’ll explore more in this post, and see how fast I can push this algorithm. Let’s begin by implementing what was done in Python […]

Pass by Reference or Value?

Pass by Value Java always passes arguments by value. It’s simple in the case of primitives, a copy of the value is assigned to the function argument: As expected, this outputs: The value of the x variable (5) is passed to the doSomething method and copied to an argument named a. This local argument is […]

Binary Search in Java

This is a Java implementation of the Binary Search in Python I did earlier. Refreshing my Java 🙂 And the example client code: This outputs: There are several other options available in the JDK Arrays and Collections classes: For a more detailed explanation of binary search, please see my earlier post.

FMX Pinch and Zoom Tip

Recently when building a mobile app in FMX I had an issue getting pinch and zoom working. The recommended approach to mobile development in FMX is to have a single Form, and multiple views (frames). These views are switched in and out as required. This works very well. However, no matter what I tried I […]

Temperaments in FMX

In the programming world the first thing most of us do when trying out a new technology is to write a hello world application. It seems Temperaments has become my hello world app for experimenting with mobile applications. I have two versions in the Play Store already, one written in Xamarin (2015), and another in […]

Setting the TVertScrollBox Position

Recently in FMX, I was trying to reset the scrolling position of the TVertScrollBox to the top when re-showing a frame: The solution is to use the ScrollBy function. You have to specify how many pixels you would like to move backwards from the current position. For example, if my current Y position is 100 […]


One thing I love about using C# is reflection, it adds another paradigm to the toolkit. Recently, I revisited my old friend Activator.CreateInstance which is perfect for scenarios where you want to use generic code to create and initialize specific types of objects. Basic Example Some time ago, I wrote a simple application which plugs […]