title: Java 8 stream optimization for nested level
body: <p>How can we use optimize this stream to collect nested level and root level for a set.</p>
  
  <pre><code>final Set&lt;String&gt; groupedUsers = new HashSet&lt;&gt;();
  groups.stream().forEach(group -&gt; {
      groupedUsers.add(group.getTeamLeadId());
      groupedUsers.addAll(group.getTeamMemberIds().stream().collect(Collectors.toSet()));
  });
  </code></pre>