title: Don't get it why .stream() works fine but .parallelStream() doesn't
body: <p>I need to speed up my program and tried this by changing a .stream() to a .parallelStream().</p>
  
  <p>cars is a list of car objects. I use the id of each car to create a JsonCurrent and then use this jsonCurrent to add a new element to to carList. </p>
  
  <p>When I use .stream() this works just fine but with .parallelStream() it doesn't work. The debugger shows me that all fields of JsonCurrent are null when carService.createJson() is called.</p>
  
  <pre><code>cars.parallelStream().forEach(car -&gt; {
              JsonCurrent currentLocation = carPositionService.carPosition(car.getId());
              carList.add(carService.createJson(car, calendarWeek, currentWeek, currentLocation));
          });
  </code></pre>
  
  <h2>.stream()</h2>
  
  <p>If cars has 60 objects, carList contains 60 objects like expected.</p>
  
  <h2>.parallelStream()</h2>
  
  <p>If cars has 60 objects, carList contains 36 objects.</p>