Class SubRequestIteratorSupport<S extends SubRequest<?>>

java.lang.Object
org.snmp4j.agent.request.SubRequestIteratorSupport<S>
All Implemented Interfaces:
Iterator<S>, SubRequestIterator<S>

public class SubRequestIteratorSupport<S extends SubRequest<?>> extends Object implements SubRequestIterator<S>
This support class allows to implement a SubRequestIterator instance based on an Iterator that iterates on SubRequest instances.
Version:
3.1.0
Author:
Frank Fock
  • Constructor Details

    • SubRequestIteratorSupport

      public SubRequestIteratorSupport(Iterator<?> subRequests)
      Creates a SubRequestIterator that decorates an Iterator.
      Parameters:
      subRequests - an Iterator on SubRequest instances or instances of other objects if mapToSubRequest(Object element) is implemented (overwritten) accordingly.
  • Method Details

    • hasNext

      public boolean hasNext()
      Description copied from interface: SubRequestIterator
      Returns true if there are more sub-requests to process. In other words, returns true if next would return an element rather than throwing an exception.
      Specified by:
      hasNext in interface Iterator<S extends SubRequest<?>>
      Specified by:
      hasNext in interface SubRequestIterator<S extends SubRequest<?>>
      Returns:
      true if there are more sub-requests.
    • next

      public S next()
      Description copied from interface: SubRequestIterator
      Gets the next sub-request that is pending.
      Specified by:
      next in interface Iterator<S extends SubRequest<?>>
      Specified by:
      next in interface SubRequestIterator<S extends SubRequest<?>>
      Returns:
      an unprocessed SubRequest instance.
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<S extends SubRequest<?>>
    • mapToSubRequest

      protected S mapToSubRequest(Object element)
      Returns the SubRequest contained or represented by the supplied object (element of the iterator). The default implementation simply casts the supplied object to SubRequest.
      Parameters:
      element - an Object from which a SubRequest can be deduced.
      Returns:
      a SubRequest instance.