Tag Archives: Java

Unknown Java Features Part 2: TimeUnit

Simple Way to use different time units TimeUnit is the simplest way to work with different time units since Java 5. Aren’t you annoyed about writing all the time how to convert e.g. minutes to milliseconds? Like “5 * 60 … Continue reading

Posted in common practice, Java, Unknown feature | Tagged , | Leave a comment

Unknown Java Features Part 1: BitSet

BitSet – the holy grail of working with bits What does it solve? java.util.BitSet solves the memory consumption of boolean[]. Adding a tiny CPU overhead. And offering a lot of helpful methods. It’s available since Java 1.0. Boolean and memory in detail … Continue reading

Posted in Unknown feature | Tagged , , , , , , , | 2 Comments

Autoboxing Performance

Preface Because of my previous post about autoboxing I get many search queries about autoboxing performance. Now I’m curious, too. So let’s get ready for some benchmarks. When we talk about boxing performance, then we always have two sides. Throughput … Continue reading

Posted in Java, Performance | Tagged , , , , | 2 Comments

micro benchmarking with openjdks jmh

Micro benchmarking in Java What is micro benchmarking? It’s for benchmarking very small parts of logic. Small like e.g. arraylist.add or string.split. Why do we have a problem with micro benchmarking? Often you encounter some blog post where someone claims that … Continue reading

Posted in Tooling | Tagged , , , , , | 2 Comments

Singleton Pattern

The singleton pattern is one every developer must know. It is a class which has only one instance, which is handled inside it. You can only get the instance, but never (reflection etc excluded) create a new instance. Advantages It can … Continue reading

Posted in common practice, Java, tips | Tagged , , | Leave a comment

Use Jaxb where possible

I was asked in an job interview, if I know something about DOM or SAX parsing. I know something about it, but I have only used it once. Why should I bother myself with this, when I just can use … Continue reading

Posted in Java, tips | Tagged , , | Leave a comment

Java 7 is here…..it’s about time

Finally after a long time Java 7 is finally here. It has many features. The most interesting features in my opinion are: NIO 2, which is a real revolting to Java IO Syntax extensions: Automatic resource cleanup(instead of close in … Continue reading

Posted in News | Tagged , , | 1 Comment

JaCoCo – the new and revolting Java Code Coverage tool

I’ve stumpled across JaCoCo while searching for a possibility to have the code coverage of a multi modul project merged. JaCoCo is made from the same developer, which made the eclipse plugin EclEmma. The big advantage (and disadvantage maybe) is … Continue reading

Posted in Java, Tooling | Tagged , , , , , | Leave a comment

calendar.equals is evil (especially over RMI)

And again I stumbled across a problem of the date/time API of the JVM. This time it is the java.util.Calendar object. The Calendar object violates against the x.compareTo(y)==0       ==         x.equals(y)           recommendation. It’s not a … Continue reading

Posted in Java, Problems | Tagged , , , | Leave a comment

Autoboxing: Traps and Advantages

What is ‘autoboxing’ some people might ask? Autoboxing is a feature, which was added in Java 5. Autoboxing is the automatic conversion of primitive data types like int, double, long, boolean to its wrapper Object Integer, Double… and vice versa. … Continue reading

Posted in common practice, Java, Performance, Uncategorized | Tagged , , , , | Leave a comment