Java has introduced a new date and time API in Java 8. The interface is much more intuitive than the old java.util.Date and java.util.Calendar based APIs. The new library was developed and integrated via JSR-310 and is heavily inspired from the popular Joda-Time library. It has a comprehensive set of classes for various use cases (as you’ll […]

A new beta release of StackHunter, our Java exception tracker, is now available for download. StackHunter notifies you when your Java apps fail. It sends out email alerts for uncaught exceptions and provides a dashboard for viewing all your exceptions (plus their associated HTTP request, cookies, etc.) in one place. Download You can pick up […]

The visitor pattern often comes to mind when you need to operate on a graph of objects (like JSON, XML, or Java beans). Unfortunately, the visitor pattern uses call backs which are difficult to control from the calling code. For example, it’s not easy to conditionally skip a branch with all its child branches and leaves […]

Lambda expressions are the most touted feature of Java 8. They promise to reduce the amount of code you have to write, make your code less error-prone, and make it easier to read. Let’s understand how lambdas manage to do all this using an example.

Before Java 8 your interfaces could contain method declarations, but no implementation code. One of the new features of Java 8 is the option to provide default implementations for methods right in your interface code itself.

Do your web apps need to run in the servlet containers from different vendors? How do you manage their vendor specific security settings? I recently ran into this exact problem while developing StackHunter. Like me, you probably started with container-managed security as you have many times before. The pain probably started after you tried deploying […]

You would think adding query parameters with special characters to a URI would be easy in Java, but you’d be wrong. The java.net.URI class tries to do some URL encoding, but runs into trouble with characters like ampersands, question marks, and slashes. Here’s a quick URI workaround that doesn’t rely on third-party libraries.

Last week I migrated Stack Hunter’s back-end from MongoDB to MySQL. (There was no problem MongoDB, it’s just easier for most users to connect to their existing MySQL database than install something new.) In the process I spent some time optimizing the new database queries and indexes to make things snappy. I started by loading […]