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

IteratorChain should include factory methods for decorating iterator lists and arrays into locked IteratorChain.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 3.2
    • None
    • Iterator
    • None
    • n/a

    Description

      IteratorChain should not instantiate an ArrayList for every new instance.

      A private constructor taking a list should be added.

      Then we can add static factory methods for decorating a list of iterators to produce a locked chain:

      public static IteratorChain decorate( List iterators )

      { final IteratorChain chain = new IteratorChain( iterators ); chain.lockChain(); return chain; }

      private IteratorChain( List iteratorChain )

      { this.iteratorChain = iteratorChain; }

      public IteratorChain()

      { this( new ArrayList() ); }

      Some other observations:

      1. There's a copy/paste mistake in the comment above the isLocked member declaration (it says ComparatorChain is "locked" after the first time compare(Object,Object) is called).

      2. It's probably impossible to change now but the naming/semantics of IteratorChain, ComparatorChain, and ChainedTransformer should all be identical. There's a lot of duplicated functionality among these 3 classes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            os111 ori
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: