Don’t use the double-brace initialization trick

Introduction Java unfortunately does not have a convenient syntax for initializing collections. There’s a trick that developers sometimes use, the double-brace initialization trick, to make initializing for example a Map more convenient. This trick has obvious and less obvious disadvantages and you should not use it. In this post I...