Class FilteringIterator<T>

    • Constructor Detail

      • FilteringIterator

        public FilteringIterator​(Iterator<T> iterator,
                                 FilteringIterator.Type type,
                                 int size)
        Constructs a filtering iterator.
        Parameters:
        iterator - the base iterator.
        type - the equality checking type.
        size - the cache size.
      • FilteringIterator

        public FilteringIterator​(Iterator<T> iterator,
                                 FilteringIterator.Type type)
        Constructs a filtering iterator with the unlimited cache size.
        Parameters:
        iterator - the base iterator.
        type - the equality checking type.
      • FilteringIterator

        public FilteringIterator​(Iterator<T> iterator,
                                 int size)
        Constructs a filtering iterator.
        Parameters:
        iterator - the base iterator.
        size - the cache size.
      • FilteringIterator

        public FilteringIterator​(Iterator<T> iterator)
        Constructs a filtering iterator with the unlimited cache size.
        Parameters:
        iterator - the base iterator.
      • FilteringIterator

        public FilteringIterator​(FilteringIterator<T> other)
        Constructs a copy of the iterator.
        Parameters:
        other - the iterator to be copied.
    • Method Detail

      • equals

        protected boolean equals​(T lhs,
                                 T rhs)
        Checks whether two values are equal (can be overloaded in a subclass).
        Parameters:
        lhs - the left-hand-side value.
        rhs - the right-hand-side value.
        Returns:
        true if the value are equal; false otherwise.
      • init

        public void init()
        Description copied from interface: Iterator
        Initializes the iterator.
        Specified by:
        init in interface Iterator<T>
      • hasValue

        public boolean hasValue()
        Description copied from interface: Iterator
        Checks if the iterator is not exhausted (a value is available).
        Specified by:
        hasValue in interface Iterator<T>
        Returns:
        true if the iterator is not exhausted; false otherwise.
      • value

        public T value()
        Description copied from interface: Iterator
        Returns the current value of the iterator.
        Specified by:
        value in interface Iterator<T>
        Returns:
        the current value of the iterator.
      • next

        public void next()
        Description copied from interface: Iterator
        Makes an iteration.
        Specified by:
        next in interface Iterator<T>
      • stop

        public void stop()
        Description copied from interface: Iterator
        Stops the iterator.
        Specified by:
        stop in interface Iterator<T>
      • clone

        public FilteringIterator<T> clone()
        Description copied from interface: Iterator
        Creates a copy of the iterator.
        Specified by:
        clone in interface Iterator<T>
        Overrides:
        clone in class java.lang.Object
        Returns:
        A copy of the iterator.