-
A Few Astronomical Examples in Kotlin
The website Open Notify provides a few URLs that return JSON data from NASA. There are currently three links supported: Number of people in space Current location of the International Space Station Overhead pass predictions for the ISS Just for fun, this blog post uses Kotlin to access each one, transform the results in Kotlin…
-
Fibonacci in Kotlin
I didn’t realize it until I noticed the trending topic on Twitter, but Saturday, November 23 was Fibonacci Day. That gave me an opportunity to drag out one of my favorite old jokes: For those unaware or who don’t remember, the Fibonacci series starts with 0 and 1, and then each subsequent number is the…
-
Annotated TOC for Kotlin Cookbook
Last week I received an email asking about a table Of contents for my new Kotlin Cookbook, saying they couldn’t find one either on the O’Reilly Media site or on Amazon. It’s a lot easier to make a decision about buying a recipe book if you have a list of recipes. When I checked last…
-
Kotlin Palindrome Checker
This post, based on code from my new Kotlin Cookbook, shows how to write a palindrome checker in Kotlin. Along the way it discusses raw strings and regular expressions, writing functions as single statements, and creating an extension function on String. First, a quick definition. A palindrome is a string whose characters are the same…
-
A Deep Dive into the KotlinVersion Class
Getting the current Kotlin version is easy, but the actual KotlinVersion class is much more interesting. This post shows how to get the Kotlin version programmatically, but then looks at the details of the KotlinVersion class, including how it demonstrates a great way to write an equals method and more. Note that this demo is…
-
Java 11 HttpClient, Gson, Gradle, and Modularization
This post describes a simple system that uses the new HttpClient class that comes with Java 11 to access a RESTful web service. After demonstrating basic functionality, changes are made to parse the results using Gson, and even modularize the code and have it work with Gradle. The goal is to provide an example for…
-
Managing Your Manager: The Video Course
I’m a regular speaker on the No Fluff, Just Stuff tour (I’m now entering my ninth year, which I can hardly believe), and one of the talks I’ve given there for many years is called “Managing Your Manager”. It’s been one of my most successful talks, and I’ve given several versions of it, including as…
-
Java 8 Constructor Refs (In All Their Glory)
[Note: my last post announced my new book, Modern Java Recipes, is now available from O’Reilly publishers in Early Release form. As a sample, I included a discussion of the Predicate interface, one of the new functional interfaces in the the java.util.function package. In this post, I highlight constructor references, which are discussed in another…
-
Modern Java Recipes now in Early Release
My latest book, Modern Java Recipes, is now available in Early Release form! If you have a Safari account (the online book repository from O’Reilly), you can add it to your bookshelf at any time. Otherwise, you can get it directly from http://shop.oreilly.com or even at Amazon.com. There are only three chapters in the Early…
-
Days Between Dates in Java 8
I would like to address a problem that is quite topical at the moment: calculating the number of days between two events. The new Date-Time API in Java 8 makes this process much simpler than it used to be. The Date-Time API includes the interface java.time.temporal.TemporalUnit, which is implemented by the enum ChronoUnit in the…