title: Stream doesn't preserve the order after grouping
body: <p>I have a List name <strong>availableSeats</strong> I am sorting and grouping by the <strong>blockIndex</strong> property like below:</p>
  
  <pre><code>availableSeats.stream()
                  .sorted(Comparator.comparing(SeatedTicketAssignment::getBlockIndex))
                  .collect(Collectors.groupingBy(SeatedTicketAssignment::getBlockIndex))
                  .forEach((block, blockAssignments) -&gt; {
                       //Rest of the code
                  } 
  </code></pre>
  
  <p>The problem is that the result of grouping by is not sorted by the blockIndex.</p>