Class ListIteratorWrapper
- java.lang.Object
-
- org.apache.commons.collections.iterators.ListIteratorWrapper
-
- All Implemented Interfaces:
java.util.Iterator,java.util.ListIterator,ResettableIterator,ResettableListIterator
@Deprecated(since="2021-04-30") public class ListIteratorWrapper extends java.lang.Object implements ResettableListIterator
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.Converts an iterator into a list iterator by caching the returned entries.The
ListIteratorinterface has additional useful methods for navigation -previous()and the index methods. This class allows a regularIteratorto behave as aListIterator. It achieves this by building a list internally of as the underlying iterator is traversed.The optional operations of
ListIteratorare not supported.This class implements ResettableListIterator from Commons Collections 3.2.
- Since:
- Commons Collections 2.1
-
-
Constructor Summary
Constructors Constructor Description ListIteratorWrapper(java.util.Iterator iterator)Deprecated.Constructs a newListIteratorWrapperthat will wrap the given iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(java.lang.Object obj)Deprecated.ThrowsUnsupportedOperationException.booleanhasNext()Deprecated.Returns true if there are more elements in the iterator.booleanhasPrevious()Deprecated.Returns true if there are previous elements in the iterator.java.lang.Objectnext()Deprecated.Returns the next element from the iterator.intnextIndex()Deprecated.Returns in the index of the next element.java.lang.Objectprevious()Deprecated.Returns the the previous element.intpreviousIndex()Deprecated.Returns the index of the previous element.voidremove()Deprecated.ThrowsUnsupportedOperationException.voidreset()Deprecated.Resets this iterator back to the position at which the iterator was created.voidset(java.lang.Object obj)Deprecated.ThrowsUnsupportedOperationException.
-
-
-
Method Detail
-
add
public void add(java.lang.Object obj) throws java.lang.UnsupportedOperationExceptionDeprecated.ThrowsUnsupportedOperationException.- Specified by:
addin interfacejava.util.ListIterator- Parameters:
obj- the object to add, ignored- Throws:
java.lang.UnsupportedOperationException- always
-
hasNext
public boolean hasNext()
Deprecated.Returns true if there are more elements in the iterator.- Specified by:
hasNextin interfacejava.util.Iterator- Specified by:
hasNextin interfacejava.util.ListIterator- Returns:
- true if there are more elements
-
hasPrevious
public boolean hasPrevious()
Deprecated.Returns true if there are previous elements in the iterator.- Specified by:
hasPreviousin interfacejava.util.ListIterator- Returns:
- true if there are previous elements
-
next
public java.lang.Object next() throws java.util.NoSuchElementExceptionDeprecated.Returns the next element from the iterator.- Specified by:
nextin interfacejava.util.Iterator- Specified by:
nextin interfacejava.util.ListIterator- Returns:
- the next element from the iterator
- Throws:
java.util.NoSuchElementException- if there are no more elements
-
nextIndex
public int nextIndex()
Deprecated.Returns in the index of the next element.- Specified by:
nextIndexin interfacejava.util.ListIterator- Returns:
- the index of the next element
-
previous
public java.lang.Object previous() throws java.util.NoSuchElementExceptionDeprecated.Returns the the previous element.- Specified by:
previousin interfacejava.util.ListIterator- Returns:
- the previous element
- Throws:
java.util.NoSuchElementException- if there are no previous elements
-
previousIndex
public int previousIndex()
Deprecated.Returns the index of the previous element.- Specified by:
previousIndexin interfacejava.util.ListIterator- Returns:
- the index of the previous element
-
remove
public void remove() throws java.lang.UnsupportedOperationExceptionDeprecated.ThrowsUnsupportedOperationException.- Specified by:
removein interfacejava.util.Iterator- Specified by:
removein interfacejava.util.ListIterator- Throws:
java.lang.UnsupportedOperationException- always
-
set
public void set(java.lang.Object obj) throws java.lang.UnsupportedOperationExceptionDeprecated.ThrowsUnsupportedOperationException.- Specified by:
setin interfacejava.util.ListIterator- Parameters:
obj- the object to set, ignored- Throws:
java.lang.UnsupportedOperationException- always
-
reset
public void reset()
Deprecated.Resets this iterator back to the position at which the iterator was created.- Specified by:
resetin interfaceResettableIterator- Specified by:
resetin interfaceResettableListIterator- Since:
- Commons Collections 3.2
-
-