title: How do I know if Java Stream collect(Collectors.toMap) is parallelized?
body: <p>I have the following code that attempts to populate a Map from a List in a parallel fashion by going through the Java Stream API:</p>
  
  <pre><code>class NameId {...}
  
  public class TestStream
  {
      static public void main(String[] args)
      {
          List&lt;NameId &gt; niList = new ArrayList&lt;&gt;();
          niList.add(new NameId ("Alice", "123456"));
          niList.add(new NameId ("Bob", "223456"));
          niList.add(new NameId ("Carl", "323456"));
  
          Stream&lt;NameId&gt; niStream = niList.parallelStream();
          Map&lt;String, String&gt; niMap = niStream.collect(Collectors.toMap(NameId::getName, NameId::getId));
      }
  }
  </code></pre>
  
  <p>How do I know if the map is populated using multiple threads, i.e. in parallel? Do I need to call Collectors.toConcurrentMap instead of Collectors.toMap? Is this a reasonable way to parallelize the population of a map? How do I know what the concrete map is backing the new niMap (e.g. is it HashMap)?</p>