Package org.apache.commons.collections.iterators

Examples of org.apache.commons.collections.iterators.IteratorChain


        } catch (RepositoryException re) {
            log.warn("inconsistent hierarchy state", re);
        }
        // create an iterator over the collected descendants
        // in decreasing depth order
        IteratorChain resultIter = new IteratorChain();
        for (int i = la.length - 1; i >= 0; i--) {
            List list = la[i];
            if (list != null) {
                resultIter.addIterator(list.iterator());
            }
        }
        /**
         * if the resulting iterator chain is empty return
         * EMPTY_LIST.iterator() instead because older versions
         * of IteratorChain (pre Commons Collections 3.1)
         * would throw UnsupportedOperationException in this
         * situation
         */
        if (resultIter.getIterators().isEmpty()) {
            return Collections.EMPTY_LIST.iterator();
        }
        return resultIter;
    }
View Full Code Here


     */
    public Iterator iterator() {
        if (this.all.length == 0) {
            return EmptyIterator.INSTANCE;
        }
        IteratorChain chain = new IteratorChain();
        for (int i = 0; i < this.all.length; ++i) {
            chain.addIterator(this.all[i].iterator());
        }
        return chain;
    }
View Full Code Here

     * @param iterator2  the first iterators to use, not null
     * @return a combination iterator over the iterators
     * @throws NullPointerException if either iterator is null
     */
    public static Iterator chainedIterator(Iterator iterator1, Iterator iterator2) {
        return new IteratorChain(iterator1, iterator2);
    }
View Full Code Here

     * @param iterators  the iterators to use, not null or empty or contain nulls
     * @return a combination iterator over the iterators
     * @throws NullPointerException if iterators array is null or contains a null
     */
    public static Iterator chainedIterator(Iterator[] iterators) {
        return new IteratorChain(iterators);
    }
View Full Code Here

     * @return a combination iterator over the iterators
     * @throws NullPointerException if iterators collection is null or contains a null
     * @throws ClassCastException if the iterators collection contains the wrong object type
     */
    public static Iterator chainedIterator(Collection iterators) {
        return new IteratorChain(iterators);
    }
View Full Code Here

    sortListener = (SortListener) restoreAttachedState(context, values[3]);
  }

  @SuppressWarnings("unchecked")
  protected Iterator<UIComponent> dataChildren() {
    IteratorChain chain = new IteratorChain();
    //RF-1248 Adding facets to both dataChildren and fixed children
    //To make both supports and header/footer work
    chain.addIterator(getFacets().values().iterator());
    for (Iterator<UIComponent> i = getChildren().iterator(); i.hasNext(); ) {
      UIComponent kid = (UIComponent)i.next();
      if (kid instanceof Column || kid instanceof UIColumn) {
        chain.addIterator(kid.getChildren().iterator());
      }
    }
   
    return chain;
  }
View Full Code Here

    return chain;
  }
 
  @SuppressWarnings("unchecked")
  protected Iterator<UIComponent> fixedChildren() {
    IteratorChain chain = new IteratorChain(getFacets().values().iterator());
    //RF-1248 Adding facets to both dataChildren and fixed children
    //To make both supports and header/footer work
    for (Iterator<UIComponent> i = getChildren().iterator(); i.hasNext(); ) {
      UIComponent kid = (UIComponent)i.next();
      if (kid instanceof Column || kid instanceof UIColumn) {
        chain.addIterator(kid.getFacets().values().iterator());
      }
    }
   
    return chain;
  }
View Full Code Here

       
        return model;
      }

      public Iterator getModelsIterator() {
        IteratorChain chain = new IteratorChain();
        chain.addIterator(super.getModelsIterator());
        chain.addIterator(this.getParent().getModelsIterator());

        return chain;
      }

      protected boolean isActive() {
View Full Code Here

    Instance zooInst = new ZooKeeperInstance(instance, keepers);
    MetaDataTableScanner rootScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(),
        Constants.ROOT_TABLET_EXTENT.toMetadataRange());
    MetaDataTableScanner metaScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(), Constants.NON_ROOT_METADATA_KEYSPACE);
    @SuppressWarnings("unchecked")
    Iterator<TabletLocationState> scanner = (Iterator<TabletLocationState>) new IteratorChain(rootScanner, metaScanner);
    final AtomicBoolean scanning = new AtomicBoolean(false);
    LiveTServerSet tservers = new LiveTServerSet(zooInst, new Listener() {
      @Override
      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
        if (!deleted.isEmpty() && scanning.get())
View Full Code Here

        private boolean removeCleanInternal(StateManagerImpl sm) {
            return _clean != null && _clean.remove(sm);
        }

        public Iterator iterator() {
            IteratorChain chain = new IteratorChain();
            if (_dirty != null && !_dirty.isEmpty())
                chain.addIterator(_dirty.iterator());
            if (_clean != null && !_clean.isEmpty())
                chain.addIterator(_clean.iterator());
            return chain;
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.iterators.IteratorChain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.