Core Java
-
Using PowerMock to Mock Constructors
In my opinion, one of the main benefits of dependency injection is that you can inject mock and/or stub objects…
Read More » -
Java Hidden code
Sometime ago I came across the issue of invisible characters in Strings. These can really cause confusion because they are…
Read More » -
Duck typing in Java ? Well, not exactly
According to Wikipedia duck typing is: style of dynamic typing in which an object’s methods and properties determine the valid…
Read More » -
Building OpenJDK on Windows
Doing some experiments, I found that it often useful to have JDK source code available in hand to make some…
Read More » -
Java Annotations – Retention
Consider a Java annotation: public @interface AnAnnotaton { } A class with this annotation applied on it: @AnAnnotaton class AnAnnotatedClass{…
Read More » -
A Generic and Concurrent Object Pool
In this post we will take a look at how we can create an object pool in Java. In recent…
Read More » -
Java: Choosing the right Collection
Here is a quick guide for selecting the proper implementation of a Set , List , or Map in your application. The best general purpose or…
Read More » -
Common code violations in Java
At work, recently I did a code cleanup of an existing Java project. After that exercise, I could see a…
Read More » -
Java Memory Profiling Simplified
As a typical Java developer I never monitored the memory usage of my application apart from following typical best practices…
Read More »