title: why the TypeToken construction in Gson is so weird?
body: <p>When I use Gson to parse between object and json, the initialization of a TypeToken is so weird:</p>
  
  <pre><code>Type collectionType = new TypeToken&lt;Collection&lt;Integer&gt;&gt;(){}.getType();
  </code></pre>
  
  <p>I just know this kind of format: <code>new TypeToken&lt;Collection&lt;Integer&gt;&gt;().getType();</code>, what's the braces in above for? Thanks in advance!</p>
  
  <p><strong>P.S.</strong> I've looked into the source code of <code>TypeToken</code> class, it is a <code>class</code>(not interface or abstract) and without any constructor, which means it uses <code>no-parameter constructor</code> as default.</p>
  
  <p><strong>P.S.2</strong> When I delete the braces, it tell me that the constructor is not visible. When I looked inside the TypeToken class, this is the constructor:</p>
  
  <pre><code>  protected TypeToken() {
          this.type = getSuperclassTypeParameter(getClass());
          this.rawType = (Class&lt;? super T&gt;) $Gson$Types.getRawType(type);
          this.hashCode = type.hashCode();
    }
  </code></pre>
  
  <p>Why doesn't it just use <code>public</code> instead?</p>