Oracle® Coherence Java API Reference
v3.5.3

E15583-01

com.tangosol.util
Class RestrictedCollections.RestrictedListIterator

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.RestrictedCollections.RestrictedListIterator
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator
Enclosing class:
RestrictedCollections

public static class RestrictedCollections.RestrictedListIterator
extends Base
implements java.util.ListIterator

A restricted ListIterator that requires its contents to be of a specified class.


Field Summary
protected  java.lang.Class m_clz
          The class of Objects stored in the ListIterator.
protected  java.util.ListIterator m_iter
          The underlying ListIterator.
 
Constructor Summary
RestrictedCollections.RestrictedListIterator(java.util.ListIterator iter, java.lang.Class clz)
          Constructor.
 
Method Summary
 void add(java.lang.Object o)
          Inserts the specified element into the list.
protected  void checkObject(java.lang.Object o)
          Check the passed object to verify that it passes the restriction of this ListIterator.
 boolean hasNext()
          Returns true if this list iterator has more elements when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this list iterator has more elements when traversing the list in the reverse direction.
 java.lang.Object next()
          Returns the next element in the list.
 int nextIndex()
          Returns the index of the element that would be returned by a subsequent call to next.
 java.lang.Object previous()
          Returns the previous element in the list.
 int previousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous.
 void remove()
          Removes from the list the last element that was returned by next or previous.
 void set(java.lang.Object o)
          Replaces the last element returned by next or previous with the specified element.
 

Field Detail

m_iter

protected java.util.ListIterator m_iter
The underlying ListIterator.


m_clz

protected java.lang.Class m_clz
The class of Objects stored in the ListIterator.

Constructor Detail

RestrictedCollections.RestrictedListIterator

public RestrictedCollections.RestrictedListIterator(java.util.ListIterator iter,
                                                    java.lang.Class clz)
Constructor.

Parameters:
iter - the underlying ListIterator
clz - the class of objects that may be stored in the ListIterator
Method Detail

hasNext

public boolean hasNext()
Returns true if this list iterator has more elements when traversing the list in the forward direction. Obeys the general contract of ListIterator.hasNext.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface java.util.ListIterator
Returns:
true if the list iterator has more elements when traversing the list in the forward direction

next

public java.lang.Object next()
Returns the next element in the list. Obeys the general contract of ListIterator.next.

Specified by:
next in interface java.util.Iterator
Specified by:
next in interface java.util.ListIterator
Returns:
the next element in the list

hasPrevious

public boolean hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction. Obeys the general contract of ListIterator.hasPrevious.

Specified by:
hasPrevious in interface java.util.ListIterator
Returns:
true if the list iterator has more elements when traversing the list in the reverse direction

previous

public java.lang.Object previous()
Returns the previous element in the list. Obeys the general contract of ListIterator.previous.

Specified by:
previous in interface java.util.ListIterator
Returns:
the previous element in the list
Throws:
NoSuchElementException - if the iteration has no previous element

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a subsequent call to next. Obeys the general contract of ListIterator.nextIndex.

Specified by:
nextIndex in interface java.util.ListIterator
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

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous. Obeys the general contract of ListIterator.previousIndex.

Specified by:
previousIndex in interface java.util.ListIterator
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

remove

public void remove()
Removes from the list the last element that was returned by next or previous. Obeys the general contract of ListIterator.remove.

Specified by:
remove in interface java.util.Iterator
Specified by:
remove in interface java.util.ListIterator

set

public void set(java.lang.Object o)
Replaces the last element returned by next or previous with the specified element. Obeys the general contract of ListIterator.set.

Specified by:
set in interface java.util.ListIterator
Parameters:
o - the element with which to replace the last element returned by next or previous
Throws:
java.lang.ClassCastException - if the class of the specified element prevents it from being added to this list

add

public void add(java.lang.Object o)
Inserts the specified element into the list. Obeys the general contract of ListIterator.add.

Specified by:
add in interface java.util.ListIterator
Parameters:
o - the element to insert
Throws:
java.lang.ClassCastException - if the class of the specified element prevents it from being added to this ListIterator

checkObject

protected void checkObject(java.lang.Object o)
Check the passed object to verify that it passes the restriction of this ListIterator.

Parameters:
o - the Object to check
Throws:
java.lang.ClassCastException - if the class of the passed Object prevents it from being stored in this ListIterator

Oracle® Coherence Java API Reference
v3.5.3

E15583-01

Copyright © 2000, 2010, Oracle. All rights reserved.