title: Is there a difference between initializing a variable with its declaration, or in a static initialization?
body: <p>The static initializer is called once by the classloader, which is exactly what I want, but doing the initialization outside a static code block is more readable (debatable). Is  there a difference between the two?</p>
  
  <pre><code>private static final Map&lt;MyEnum, Cheese&gt; cheeseCache;
  
      static {
          parserCache = new EnumMap&lt; MyEnum, String&gt;(MyEnum.class){{
              for(MyEnum myEnum: MyEnum.values()){
                  put(myEnum, new Cheese(myEnum)) ;
              }
  
          }};
      }
  </code></pre>
  
  <p>or this :</p>
  
  <pre><code>private static final Map&lt;Lab, LabResultParser&gt; cheeseCache 
          = new EnumMap&lt; MyEnum, String&gt;(MyEnum.class){{
              for(MyEnum myEnum: MyEnum.values()){
                  put(myEnum, new Cheese(myEnum)) ;
              }
          }};
  </code></pre>