Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-856

Document the interaction between PeekingIterator and FilteredIterator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.5.0-M1
    • 4.5.0-M3
    • Iterator
    • None

    Description

      If you have a FilteredIterator, call peek and get an element x. Then something modifies the state of that x. Then you call peek again FilteredIterator will return x even if x no longer passes the predicate.

      I think this behaviour is correct. I would not expect the the state of an iterator to change unless I called a method like next(), and I would not expect an exception like ConcurrentModificationException when the collection has not changed.

      However its an obscure edge case so it might be worth documenting it.

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            benjaminconfino Benjamin Confino
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: