public static <T> T last(T[] self) {
        if (self.length == 0) {
            throw new NoSuchElementException("Cannot access last() element from an empty Array");
        }
        return self[self.length - 1];
    }
public static < T > T last ( T [ ] self ) { if ( self . length == 0 ) { throw new NoSuchElementException ( "Cannot access last() element from an empty Array" ) ; } return self [ self . length - 1 ] ; }
Returns the last item from the array.
<pre class="groovyTestCase">
def array = [3, 4, 2].toArray()
assert array.last() == 2
</pre>

@param self an array
@return the last item from the array
@throws NoSuchElementException if the array is empty and you try to access the last() item.
@since 1.7.3