code: public static <T> T last(Iterable<T> self) {
          Iterator<T> iterator = self.iterator();
          if (!iterator.hasNext()) {
              throw new NoSuchElementException("Cannot access last() element from an empty Iterable");
          }
          T result = null;
          while (iterator.hasNext()) {
              result = iterator.next();
          }
          return result;
      }
docs: Returns the last item from the Iterable.
  <pre class="groovyTestCase">
  def set = [3, 4, 2] as LinkedHashSet
  assert set.last() == 2
  // check original unaltered
  assert set == [3, 4, 2] as Set
  </pre>
  The last element returned by the Iterable's iterator is returned.
  If the Iterable doesn't guarantee a defined order it may appear like
  a random element is returned.
  
  @param self an Iterable
  @return the last item from the Iterable
  @throws NoSuchElementException if the Iterable is empty and you try to access the last() item.
  @since 1.8.7