code: public static <T, V extends T> T inject(Collection<T> self, @ClosureParams(value=FromString.class,options="V,T") Closure<V> closure ) {
          if( self.isEmpty() ) {
              throw new NoSuchElementException( "Cannot call inject() on an empty collection without passing an initial value." ) ;
          }
          Iterator<T> iter = self.iterator();
          T head = iter.next();
          Collection<T> tail = tail(self);
          if (!tail.iterator().hasNext()) {
              return head;
          }
          // cast with explicit weaker generics for now to keep jdk6 happy, TODO: find better fix
          return (T) inject((Collection) tail, head, closure);
      }
docs: Performs the same function as the version of inject that takes an initial value, but
  uses the head of the Collection as the initial value, and iterates over the tail.
  <pre class="groovyTestCase">
  assert 1 * 2 * 3 * 4 == [ 1, 2, 3, 4 ].inject { acc, val {@code ->} acc * val }
  assert ['b'] == [['a','b'], ['b','c'], ['d','b']].inject { acc, val {@code ->} acc.intersect( val ) }
  LinkedHashSet set = [ 't', 'i', 'm' ]
  assert 'tim' == set.inject { a, b {@code ->} a + b }
  </pre>
  
  @param self         a Collection
  @param closure      a closure
  @return the result of the last closure call
  @throws NoSuchElementException if the collection is empty.
  @see #inject(Collection, Object, Closure)
  @since 1.8.7