-
Core Java
Java 11: Converting a Collection to an Array
In Java 11, a new default method, toArray(IntFunction), has been added to the java.util.Collection interface, which allows the collection’s elements…
Read More » -
Core Java
Java 11: Running single-file programs and “shebang” scripts
In Java 11, the java launcher has been enhanced to run single-file source code programs directly, without having to compile…
Read More » -
Core Java
Java: Streaming a JDBC ResultSet as CSV
In my previous post, I showed how to convert a java.sql.ResultSet to JSON and stream it back to the caller.…
Read More » -
Core Java
Java 11: New HTTP Client API
In Java 11, the incubated HTTP Client API first introduced in Java 9, has been standardised. It makes it easier…
Read More » -
Core Java
Java: Streaming a JDBC ResultSet as JSON
This post shows how you can convert a java.sql.ResultSet to JSON and stream it back to the caller. This is…
Read More » -
Core Java
Java: Mocking a ResultSet using Mockito
This post shows how you can mock a java.sql.ResultSet using Mockito. It can be used to help unit test code…
Read More » -
Core Java
Java 10: Collecting a Stream into an Unmodifiable Collection
Java 10 introduces several new methods to facilitate the creation of unmodifiable collections. The List.copyOf, Set.copyOf, and Map.copyOf methods create…
Read More » -
Core Java
Java 10: The “var” keyword
Java 10 has introduced local variable type inference with the keyword var. This means that instead of writing: Map<Department, List<Employee>>…
Read More » -
Core Java
JUnit Hamcrest Matcher for JSON
This post shows how you can write JUnit tests to check if an object matches a JSON string. This is…
Read More »