public static <A> A getLast(List<A> list) {
    	if (list == null || list.size() == 0) {
    		return null;
    	}
		return list instanceof LinkedList ? ((LinkedList<A>)list).getLast() : list.get(list.size() - 1);
	}