added code snippets from Java Magazine nr 2 2014