org.omnaest.utils.structure.collection.list.adapter
Class ListToListIteratorAdapter<E>

java.lang.Object
  extended by org.omnaest.utils.structure.collection.list.adapter.ListToListIteratorAdapter<E>
All Implemented Interfaces:
Serializable, Iterator<E>, ListIterator<E>

public class ListToListIteratorAdapter<E>
extends Object
implements ListIterator<E>, Serializable

Adapter to a given list. The modifications made to the iterator will be populated to the list and vice versa.

Author:
Omnaest
See Also:
ListIterator, Serialized Form

Constructor Summary
ListToListIteratorAdapter(List<E> list)
          Creates a new instance of a list iterator.
ListToListIteratorAdapter(List<E> list, int startIndex)
          Creates a new list iterator which returns with the first call of next() the element at the given start index position of the list.
 
Method Summary
 void add(E element)
           
 List<E> getList()
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 E next()
           
 int nextIndex()
           
 E previous()
           
 int previousIndex()
           
 void remove()
           
 void set(E element)
           
 void setList(List<E> list)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListToListIteratorAdapter

public ListToListIteratorAdapter(List<E> list)
Creates a new instance of a list iterator.


ListToListIteratorAdapter

public ListToListIteratorAdapter(List<E> list,
                                 int startIndex)
Creates a new list iterator which returns with the first call of next() the element at the given start index position of the list.

Parameters:
list -
startIndex -
Method Detail

add

public void add(E element)
Specified by:
add in interface ListIterator<E>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>
Specified by:
hasNext in interface ListIterator<E>

hasPrevious

public boolean hasPrevious()
Specified by:
hasPrevious in interface ListIterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>
Specified by:
next in interface ListIterator<E>

nextIndex

public int nextIndex()
Specified by:
nextIndex in interface ListIterator<E>

previous

public E previous()
Specified by:
previous in interface ListIterator<E>

previousIndex

public int previousIndex()
Specified by:
previousIndex in interface ListIterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>
Specified by:
remove in interface ListIterator<E>

set

public void set(E element)
Specified by:
set in interface ListIterator<E>

getList

public List<E> getList()

setList

public void setList(List<E> list)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.