Android examples for java.util:List Element
Get last item from List
//package com.java2s; import java.util.Collection; import java.util.List; public class Main { public static <T> T last(final List<T> c) { return isNullOrEmpty(c) ? null : c.get(c.size() - 1); }// ww w .ja v a 2 s .co m public static boolean isNullOrEmpty(final Collection<?> c) { return c == null || c.isEmpty(); } }