I prefer a static method call for initialization over a static initializer block, when possible:
I think the former is slighty more readable, especially when there's initialization code like that for more than one variable, and because init blocks tend to clutter up variable declaration code.
Just a slight preference.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jelle Klap wrote:I prefer a static method call for initialization over a static initializer block, when possible:
The second does have one advantage, which is that the block cannot be called more than once. (OK, calling the second one more than once doesn't really hurt in this case, but it's nice for the intention to be clear). I agree that the first is more readable, and that probably makes me prefer it.