title: Java: how to transform from List<T> to Map<f1(T), List(f2(T))> without iterating
body: <p>I have a list of objects that I need to transform to a map where the keys are a function of each element, and the values are lists of another function of each element. Effectively this is grouping the elements by a function of them.</p>
  
  <p>For example, suppose a simple element class:</p>
  
  <pre><code>class Element {
      int f1() { ... }
      String f2() { ... }
  }
  </code></pre>
  
  <p>and a list of these:</p>
  
  <pre><code>[
      { f1=100, f2="Alice" },
      { f1=200, f2="Bob" },
      { f1=100, f2="Charles" },
      { f1=300, f2="Dave" }
  ]
  </code></pre>
  
  <p>then I would like a map as follows:</p>
  
  <pre><code>{
      {key=100, value=[ "Alice", "Charles" ]},
      {key=200, value=[ "Bob" ]},
      {key=300, value=[ "Dave" ]}
  }
  </code></pre>
  
  <p>Can anyone suggest a succinct way of doing this in Java <strong>without iterating</strong>? A combination of LambdaJ's <code>group</code> method with Guava's <code>Maps.transform</code> nearly gets there, but <code>group</code> doesn't generate a map.</p>