List of utility methods to do List Reverse
List | reverseCopy(List Returns a reversed shallow copy of the given list. List<E> result = new ArrayList<E>(original.size()); if (original instanceof RandomAccess) { for (int i = original.size() - 1; i >= 0; i--) { result.add(original.get(i)); } else { ListIterator<E> it = original.listIterator(original.size()); while (it.hasPrevious()) { ... |
Iterable | reversed(final List reversed return new Iterable<T>() { public Iterator<T> iterator() { return new Iterator<T>() { final ListIterator<T> it = list.listIterator(list.size()); public boolean hasNext() { return it.hasPrevious(); public T next() { ... |
List | reversed(List A reversed copy of the given list List<T> copy = new ArrayList<T>(l); Collections.reverse(copy); return copy; |
Iterable | reversed(List reversed return () -> { ListIterator<T> li = list.listIterator(list.size()); return new Iterator<T>() { @Override public boolean hasNext() { return li.hasPrevious(); @Override ... |
void | reversedCopy(List reversed Copy dest.clear();
for (T e : src) {
dest.add(0, e);
|
Iterable | reverseIterable(final List Allows a foreach loop to iterate backwards over a list from the end to the start. return iterable(reverseIterator(list));
|
Iterator | reverseIterator(final List Returns an iterator that iterates backwards over the given list. return new Iterator<T>() { ListIterator<T> iterator = list.listIterator(list.size()); public boolean hasNext() { return iterator.hasPrevious(); public T next() { return iterator.previous(); public void remove() { throw new UnsupportedOperationException("remove() not supported"); }; |
Iterator | reverseIterator(List reverse Iterator final ListIterator<T> listIterator = list.listIterator(list.size()); return new Iterator<T>() { @Override public boolean hasNext() { return listIterator.hasPrevious(); @Override public T next() { ... |
Iterable | reverseIterator(ListIterator reverse Iterator return () -> new Iterator<T>() { @Override public boolean hasNext() { return iterator.hasPrevious(); @Override public T next() { return iterator.previous(); ... |
Iterable | reverseList(final List Reverses the given list for iteration. return new Iterable<T>() { @Override public Iterator<T> iterator() { final ListIterator<T> li = list.listIterator(list.size()); return new Iterator<T>() { @Override public boolean hasNext() { return li.hasPrevious(); ... |