Hello, Scala (free preview)

If you like free things, here’s a link to a free preview of the new version of my book, “Hello, Scala.” The book is 257 pages long, and the free preview contains the first 120 pages of it, so I hope it’s a significant preview.

The new version of the book isn’t currently available for sale, but I hope to release print, PDF, and Kindle versions of it in the next few weeks.

JMH, an SBT plugin for running OpenJDK JMH benchmarks

JMH is an SBT plugin for running OpenJDK JMH benchmarks. Per its docs, “JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.”

They also recommend reading an article titled Nanotrusting the Nanotime if you’re interested in writing your own benchmark tests.

Scala: How to list files and directories under a directory

When using Scala, if you ever need to list the subdirectories in a directory, or the files under a directory, I hope this example is helpful:


object FileTests extends App {

    // list only the folders directly under this directory (does not recurse)
    val folders: Array[File] = (new File("/Users/al"))
        .filter(_.isDirectory)  //isFile to find files


If it helps to see it, a longer version of that solution looks like this:

Scala immutable Map class: methods, examples, and syntax alvin August 9, 2018 - 4:38pm

This page contains a large collection of examples of how to use the Scala Map class, including most of the methods that are available on a Vector. (Currently well over 100 examples.)