Android Utililty Methods List Reverse

List of utility methods to do List Reverse

Description

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

Method

ListinvertList(List list)
Invert / Reverse the provided List .
if (isEmpty(list)) {
    return list;
List<V> invertList = new ArrayList<V>(list.size());
for (int i = list.size() - 1; i >= 0; i--) {
    invertList.add(list.get(i));
return invertList;
...
voidreverse(List list, final int begin, final int end)
reverse
if (end <= begin)
    throw new IllegalArgumentException("end <= begin");
if (end - begin == 1)
    return;
List<E> reversed = new ArrayList<E>(end - begin);
for (int i = begin; i != end; ++i) {
    final int j = begin + (end - i - 1);
    reversed.add(list.get(j));
...
Listreverse(List list)
reverse
List<T> tmp = new ArrayList<T>(list);
list.clear();
for (int index = tmp.size() - 1; index >= 0; index--) {
    list.add(tmp.get(index));
return list;