title: Jackson - Deserialising JSON string - TypeReference vs TypeFactory.constructCollectionType
body: <p>To deserialise JSON string to a list of class, different ways listed at <a href="https://stackoverflow.com/questions/7246157/how-to-parse-a-json-string-to-an-array-using-jackson">StackOverflow question</a></p>
  <p>Type 1 (<a href="https://fasterxml.github.io/jackson-core/javadoc/2.5/com/fasterxml/jackson/core/type/TypeReference.html" rel="nofollow noreferrer">docs link</a>):</p>
  <pre><code>List&lt;SomeClass&gt; someClassList = mapper.readValue(jsonString, typeFactory.constructCollectionType(List.class, SomeClass.class));
  </code></pre>
  <p>Type 2 (<a href="https://fasterxml.github.io/jackson-databind/javadoc/2.5/com/fasterxml/jackson/databind/type/TypeFactory.html#constructCollectionLikeType(java.lang.Class,%20java.lang.Class)" rel="nofollow noreferrer">docs link</a>):</p>
  <pre><code>List&lt;SomeClass&gt; list = mapper.readValue(jsonString, new TypeReference&lt;List&lt;SomeClass&gt;&gt;() { });
  </code></pre>
  <p>Though both 2 types above do the job, what is the difference between these implementations ?</p>