Package org.plumelib.util
Class CollectionsP.RemoveFirstAndLastIterator<T>
java.lang.Object
org.plumelib.util.CollectionsP.RemoveFirstAndLastIterator<T>
- Type Parameters:
T- the type of elements of the iterator
- All Implemented Interfaces:
Iterator<T>
- Enclosing class:
CollectionsP
public static final class CollectionsP.RemoveFirstAndLastIterator<T>
extends Object
implements Iterator<T>
Returns an iterator just like its argument, except that the first and last elements are
removed. They can be accessed via the
getFirst() and getLast() methods.-
Method Details
-
hasNext
public boolean hasNext(@GuardSatisfied CollectionsP.RemoveFirstAndLastIterator<T> this) -
next
-
getFirst
Returns the first element of the iterator that was used to construct this. This value is not part of this iterator (unless the original iterator would have returned it multiple times).- Returns:
- the first element of the iterator that was used to construct this
-
getLast
Returns the last element of the iterator that was used to construct this. This value is not part of this iterator (unless the original iterator would have returned it multiple times).Throws an error unless the RemoveFirstAndLastIterator has already been iterated all the way to its end (so the delegate is pointing to the last element).
- Returns:
- the last element of the iterator that was used to construct this
-
remove
public void remove(@GuardSatisfied CollectionsP.RemoveFirstAndLastIterator<T> this)
-