class PIM::ItemsWithPostExhaustionDeadline::PostExhaustionIterator

Wraps a Java/Ruby iterator and invokes on_exhaustion once hasNext becomes false (including empty collections). Early stop does not fire.

Public Class Methods

new(delegate, on_exhaustion) click to toggle source
# File exporter.rb, line 86
def initialize(delegate, on_exhaustion)
  @delegate = delegate
  @on_exhaustion = on_exhaustion
  @exhausted = false
end

Public Instance Methods

hasNext() click to toggle source
# File exporter.rb, line 92
def hasNext
  more = @delegate.hasNext
  apply_if_exhausted unless more
  more
end
next() click to toggle source
# File exporter.rb, line 98
def next
  unless @delegate.hasNext
    apply_if_exhausted
    raise java.util.NoSuchElementException.new
  end
  value = @delegate.next
  apply_if_exhausted unless @delegate.hasNext
  value
end
remove() click to toggle source
# File exporter.rb, line 108
def remove
  raise java.lang.UnsupportedOperationException.new
end