Java Utililty Methods List Last Item

List of utility methods to do List Last Item

Description

The list of methods to do List Last Item are organized into topic(s).

Method

EremoveLast(List list)
Removes the last element of a given List instance.
E retval = null;
if (list != null && !list.isEmpty()) {
    retval = list.remove(list.size() - 1);
return retval;
TremoveLast(List aList)
Removes the last object from given list.
return aList.remove(aList.size() - 1);
TremoveLast(List l)
remove Last
return l.remove(l.size() - 1);
TremoveLast(List list)

removeLast.

return remove(list, list.size() - 1);
voidremoveLastElements(List list, int fromIdx)
fromIndex, inclusive, and toIndex, exclusive
list.subList(fromIdx, list.size()).clear();