public static <T> Iterable<T> reversed(List<T> elements) {
        return () -> new Iterator<T>() {
            final ListIterator<T> wrapped = elements.listIterator(elements.size());
            @Override public boolean hasNext() { return wrapped.hasPrevious(); }
            @Override public T next() { return wrapped.previous(); }
            @Override public void remove() { wrapped.remove(); }
        };
    }
@Test
    void testEmpty() {
        List<Integer> elements = new ArrayList<>();
        Iterator<Integer> iterator = Iterables.reversed(elements).iterator();
        assertFalse(iterator.hasNext());
        assertThrows(NoSuchElementException.class, iterator::next);
        assertThrows(IllegalStateException.class, iterator::remove);
    }