Java List Reverse reverseIterator(ListIterator iterator)

Here you can find the source of reverseIterator(ListIterator iterator)

Description

reverse Iterator

License

Open Source License

Declaration

public static <T> Iterable<T> reverseIterator(ListIterator<T> iterator) 

Method Source Code


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

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

public class Main {
    public static <T> Iterable<T> reverseIterator(ListIterator<T> iterator) {
        return () -> new Iterator<T>() {
            @Override//from ww  w. j a v  a  2  s . co m
            public boolean hasNext() {
                return iterator.hasPrevious();
            }

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

Related

  1. reversed(List list)
  2. reversedCopy(List src, List dest)
  3. reverseIterable(final List list)
  4. reverseIterator(final List list)
  5. reverseIterator(List list)
  6. reverseList(final List list)
  7. reverseList(List list)
  8. reverseList(List list)
  9. reverseList(List list, boolean shallowCopy)