Good question if you really don’t know what it means :) I’ve more than 7 years of software development experience and to be honest, I’ve never seen a company who uses code coverage as a metric unfortunately. We’re developing a lot of beautiful software and in most cases we’re ending up with lots of code messes :( You can argue on why it happens like this, but I’m not gonna go into that today. Let’s get back to the main topic:
Varargs Collection Factory Method
If you read my double brace post, you might find it very handy. However, sometimes you might be warned by PMD or Checkstyle for this kind of usage. Because they don’t like this kind of usages. One way to fix this problem is putting either //no pmd or suppressing method for PMD.NonStaticInitializer.
Double Brace Initialization
Java doesn’t have a really nice way to initialize the collections. Because of this creating some constant collections, passing them to a method, or using them while unit-testing is kinda way too hard. For instance; you just need a 3 items in your list, but Java expects you to define in the following way:
