Package nl.vpro.util

Class MaxOffsetIterator<T>

    • Field Detail

      • peekingWrapped

        protected com.google.common.collect.PeekingIterator<T> peekingWrapped
      • offsetmax

        protected final long offsetmax
        The maximal value of count. I.e. offset + max;
      • count

        protected long count
        The count of the next element. First value will be the supplied value of offset.
      • hasNext

        protected Boolean hasNext
      • next

        protected T next
    • Constructor Detail

      • MaxOffsetIterator

        public MaxOffsetIterator​(Iterator<T> wrapped,
                                 Number max,
                                 boolean countNulls)
      • MaxOffsetIterator

        public MaxOffsetIterator​(Iterator<T> wrapped,
                                 Number max)
      • MaxOffsetIterator

        public MaxOffsetIterator​(Iterator<T> wrapped,
                                 Number max,
                                 Number offset,
                                 boolean countNulls)
      • MaxOffsetIterator

        protected MaxOffsetIterator​(@NonNull Iterator<T> wrapped,
                                    @Nullable Number max,
                                    @Nullable Number offset,
                                    @Nullable Predicate<T> countPredicate,
                                    boolean countNulls,
                                    @Nullable List<Runnable> callbacks,
                                    boolean autoClose)
    • Method Detail

      • effectiveCountPredicate

        protected static <S> Predicate<S> effectiveCountPredicate​(Predicate<S> countPredicate,
                                                                  boolean countNulls)
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<T>
      • peek

        public T peek()
        Specified by:
        peek in interface com.google.common.collect.PeekingIterator<T>
      • next

        public T next()
        Specified by:
        next in interface Iterator<T>
        Specified by:
        next in interface com.google.common.collect.PeekingIterator<T>
      • findNext

        protected boolean findNext()
      • remove

        public void remove()
        Specified by:
        remove in interface Iterator<T>
        Specified by:
        remove in interface com.google.common.collect.PeekingIterator<T>
      • peekingWrapped

        public com.google.common.collect.PeekingIterator<T> peekingWrapped()
        Access to the (peeking) wrapped iterator. This may be used to look 'beyond' max, to check what would have been the next one.
      • getOffset

        public long getOffset()