Varargs Collection Factory Method

February 11th, 2009

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.

Java

1 Comment

Double Brace Initialization

February 11th, 2009

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:

Java

5 Comments