Java List Reverse reversed(List list)

Here you can find the source of reversed(List list)

Description

reversed

License

Open Source License

Declaration

public static <T> Iterable<T> reversed(List<T> list) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class Main {
    public static <T> Iterable<T> reversed(List<T> list) {

        return () -> {
            ListIterator<T> li = list.listIterator(list.size());

            return new Iterator<T>() {
                @Override/*  www  .j  a v a 2 s .  c o m*/
                public boolean hasNext() {
                    return li.hasPrevious();
                }

                @Override
                public T next() {
                    return li.previous();
                }
            };
        };
    }
}

Related

  1. reverseCopy(Iterable list)
  2. reverseCopy(List list)
  3. reverseCopy(List original)
  4. reversed(final List list)
  5. reversed(List l)
  6. reversedCopy(List src, List dest)
  7. reverseIterable(final List list)
  8. reverseIterator(final List list)
  9. reverseIterator(List list)