Java-8 JSONArray to HashMap
<p>I'm trying to convert <code>JSONArray</code> to a <code>Map&lt;String,String&gt;</code> via <code>streams</code> and <code>Lambdas</code>. The following isn't working:</p>

<pre><code>org.json.simple.JSONArray jsonArray = new org.json.simple.JSONArray();
jsonArray.add("pankaj");
HashMap&lt;String, String&gt; stringMap = jsonArray.stream().collect(HashMap&lt;String, String&gt;::new, (map,membermsisdn) -&gt; map.put((String)membermsisdn,"Error"), HashMap&lt;String, String&gt;::putAll);
HashMap&lt;String, String&gt; stringMap1 = jsonArray.stream().collect(Collectors.toMap(member -&gt; member, member -&gt; "Error"));
</code></pre>

<p>To Avoid typecasting in <code>Line 4</code>, I'm doing <code>Line 3</code> </p>

<p><code>Line 3</code> gives the following errors:</p>

<pre><code>Multiple markers at this line
- The type HashMap&lt;String,String&gt; does not define putAll(Object, Object) that is applicable here
- The method put(String, String) is undefined for the type Object
- The method collect(Supplier, BiConsumer, BiConsumer) in the type Stream is not applicable for the arguments (HashMap&lt;String, String&gt;::new, (&lt;no type&gt; map, &lt;no type&gt; membermsisdn) 
 -&gt; {}, HashMap&lt;String, String&gt;::putAll)
</code></pre>

<p>And <code>Line 4</code> gives the following error:</p>

<pre><code>Type mismatch: cannot convert from Object to HashMap&lt;String,String&gt;
</code></pre>

<p>I'm trying to learn Lambdas and streams. Can somebody help me out?</p>