I have a collection, I want to get the last element of the collection. What\'s the most straighforward and fast way to do so?
One solution is to first toArray(), and
Or you can use a for-each loop:
Collection items = ...; X last = null; for (X x : items) last = x;