Package it.unimi.dsi.fastutil.objects
Class ObjectBigListIterators.BigListIteratorListIterator<K>
java.lang.Object
it.unimi.dsi.fastutil.objects.ObjectBigListIterators.BigListIteratorListIterator<K>
- All Implemented Interfaces:
BidirectionalIterator<K>,BigListIterator<K>,ObjectBidirectionalIterator<K>,ObjectBigListIterator<K>,ObjectIterator<K>,Iterator<K>
- Enclosing class:
- ObjectBigListIterators
public static class ObjectBigListIterators.BigListIteratorListIterator<K> extends Object implements ObjectBigListIterator<K>
A class exposing a list iterator as a big-list iterator..
-
Method Summary
Modifier and Type Method Description voidadd(K ok)Inserts the specified element into the list (optional operation).intback(int n)Moves back for the given number of elements.longback(long n)Moves back for the given number of elements.booleanhasNext()booleanhasPrevious()Returns whether there is a previous element.Knext()longnextIndex()Returns the index of the element that would be returned by a subsequent call to next.Kprevious()Returns the previous element from the collection.longpreviousIndex()Returns the index of the element that would be returned by a subsequent call to previous.voidremove()voidset(K ok)Replaces the last element returned bynext()orprevious()with the specified element (optional operation).intskip(int n)Skips the given number of elements.longskip(long n)Skips the given number of elements.
-
Method Details
-
set
Description copied from interface:ObjectBigListIteratorReplaces the last element returned bynext()orprevious()with the specified element (optional operation).- Specified by:
setin interfaceBigListIterator<K>- Specified by:
setin interfaceObjectBigListIterator<K>- Parameters:
ok- an element.- See Also:
ListIterator.set(Object)
-
add
Description copied from interface:ObjectBigListIteratorInserts the specified element into the list (optional operation).- Specified by:
addin interfaceBigListIterator<K>- Specified by:
addin interfaceObjectBigListIterator<K>- Parameters:
ok- an element.- See Also:
ListIterator.add(Object)
-
back
public int back(int n)Description copied from interface:ObjectBidirectionalIteratorMoves back for the given number of elements.The effect of this call is exactly the same as that of calling
BidirectionalIterator.previous()forntimes (possibly stopping ifBidirectionalIterator.hasPrevious()becomes false).- Specified by:
backin interfaceObjectBidirectionalIterator<K>- Parameters:
n- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
BidirectionalIterator.previous()
-
back
public long back(long n)Description copied from interface:ObjectBigListIteratorMoves back for the given number of elements.The effect of this call is exactly the same as that of calling
previous()forntimes (possibly stopping ifBidirectionalIterator.hasPrevious()becomes false).- Specified by:
backin interfaceObjectBigListIterator<K>- Parameters:
n- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
BidirectionalIterator.previous()
-
remove
public void remove() -
skip
public int skip(int n)Description copied from interface:ObjectBigListIteratorSkips the given number of elements.The effect of this call is exactly the same as that of calling
Iterator.next()forntimes (possibly stopping ifIterator.hasNext()becomes false).- Specified by:
skipin interfaceObjectBidirectionalIterator<K>- Specified by:
skipin interfaceObjectBigListIterator<K>- Specified by:
skipin interfaceObjectIterator<K>- Parameters:
n- the number of elements to skip.- Returns:
- the number of elements actually skipped.
- See Also:
Iterator.next()
-
skip
public long skip(long n)Description copied from interface:ObjectBigListIteratorSkips the given number of elements.The effect of this call is exactly the same as that of calling
next()forntimes (possibly stopping ifIterator.hasNext()becomes false).- Specified by:
skipin interfaceObjectBigListIterator<K>- Parameters:
n- the number of elements to skip.- Returns:
- the number of elements actually skipped.
- See Also:
Iterator.next()
-
hasNext
public boolean hasNext() -
hasPrevious
public boolean hasPrevious()Description copied from interface:BidirectionalIteratorReturns whether there is a previous element.- Specified by:
hasPreviousin interfaceBidirectionalIterator<K>- Returns:
- whether there is a previous element.
- See Also:
ListIterator.hasPrevious()
-
next
-
previous
Description copied from interface:BidirectionalIteratorReturns the previous element from the collection.- Specified by:
previousin interfaceBidirectionalIterator<K>- Returns:
- the previous element from the collection.
- See Also:
ListIterator.previous()
-
nextIndex
public long nextIndex()Description copied from interface:BigListIteratorReturns the index of the element that would be returned by a subsequent call to next. (Returns list size if the list iterator is at the end of the list.)- Specified by:
nextIndexin interfaceBigListIterator<K>- Returns:
- the index of the element that would be returned by a subsequent call to next, or list size if list iterator is at end of list.
- See Also:
ListIterator.nextIndex()
-
previousIndex
public long previousIndex()Description copied from interface:BigListIteratorReturns the index of the element that would be returned by a subsequent call to previous. (Returns -1 if the list iterator is at the beginning of the list.)- Specified by:
previousIndexin interfaceBigListIterator<K>- Returns:
- the index of the element that would be returned by a subsequent call to previous, or -1 if list iterator is at beginning of list.
- See Also:
ListIterator.previousIndex()
-