public final class Peekerators extends Object
Peekerator
s.Modifier and Type | Method and Description |
---|---|
static <E> Peekerator<E> |
from(Iterator<E> delegate)
Wraps a given
Iterator as a Peekerator . |
static <E> Peekerator<E> |
from(ListIterator<E> delegate)
Wraps a given
ListIterator as a Peekerator . |
public static <E> Peekerator<E> from(Iterator<E> delegate)
Iterator
as a Peekerator
. That peekerator implements the Peekerator.peek()
operation by reading ahead (at most) one element from the underlying iterator.public static <E> Peekerator<E> from(ListIterator<E> delegate)
ListIterator
as a Peekerator
. That peekerator implements the Peekerator.peek()
operation by calling ListIterator.next()
and immediately ListIterator.previous()
.
This implementation may perform slightly better than from(Iterator)
.
Copyright © 2018 Arno Unkrig. All rights reserved.