Here you can find the source of getReversedListIterable(final List
public static <T> Iterable<T> getReversedListIterable(final List<T> inList)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.List; public class Main { public static <T> Iterable<T> getReversedListIterable(final List<T> inList) { return new Iterable<T>() { @Override/*from w w w . j a v a 2 s . c o m*/ public Iterator<T> iterator() { return getReversedListIterator(inList); } }; } public static <T> Iterator<T> getReversedListIterator(final List<T> inList) { return new Iterator<T>() { int index = inList == null ? -1 : inList.size() - 1; @Override public boolean hasNext() { return index >= 0; } @Override public T next() { return inList.get(index--); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }