Java 类org.apache.commons.collections4.iterators.IteratorChain 实例源码

项目:bifroest    文件:GetValueCommand.java   
private Iterable<Metric> _getMetrics( E environment, String name, Interval interval ) {
    log.debug( "Performing fetch for metric " + name + " for " + interval.toString() );
    Optional<List<Metric>> metricsFromCache = environment.metricCache().getValues( name, interval );

    if( metricsFromCache.isPresent() ) {
        if( !metricsFromCache.get().isEmpty()
                && metricsFromCache.get().get( 0 ).timestamp() <= interval.start() ) {
            log.debug( "Got all results we want from cache." );
            return metricsFromCache.get();
        } else {
            log.debug( "Got some results from cache, but need to get the rest from the database" );
            long refetchEnd = metricsFromCache.get().isEmpty() ? interval.end() : metricsFromCache.get().get( 0 ).timestamp();
            return new IteratorIterable<>( new IteratorChain<>(
                    environment.cassandraAccessLayer().loadMetrics( name, new Interval( interval.start(), refetchEnd ) ).iterator(),
                    metricsFromCache.get().iterator()
                    ) );
        }
    } else {
        log.debug( "Got no results from cache, need to hit the database." );
        return environment.cassandraAccessLayer().loadMetrics( name, interval );
    }
}
项目:HCFCore    文件:MultiValueMap.java   
@Override
public Iterator<V> iterator() {
    final IteratorChain<V> chain = new IteratorChain<V>();
    for (final K k : keySet()) {
        chain.addIterator(new ValuesIterator(k));
    }
    return chain;
}
项目:HCFCore    文件:CompositeSet.java   
/**
 * Gets an iterator over all the sets in this composite.
 * <p>
 * This implementation uses an <code>IteratorChain</code>.
 *
 * @return an <code>IteratorChain</code> instance which supports
 *  <code>remove()</code>. Iteration occurs over contained collections in
 *  the order they were added, but this behavior should not be relied upon.
 * @see IteratorChain
 */
public Iterator<E> iterator() {
    if (all.isEmpty()) {
        return EmptyIterator.<E>emptyIterator();
    }
    final IteratorChain<E> chain = new IteratorChain<E>();
    for (final Set<E> item : all) {
        chain.addIterator(item.iterator());
    }
    return chain;
}
项目:HCFCore    文件:CompositeCollection.java   
/**
 * Gets an iterator over all the collections in this composite.
 * <p>
 * This implementation uses an <code>IteratorChain</code>.
 *
 * @return an <code>IteratorChain</code> instance which supports
 *  <code>remove()</code>. Iteration occurs over contained collections in
 *  the order they were added, but this behavior should not be relied upon.
 * @see IteratorChain
 */
@Override
public Iterator<E> iterator() {
    if (all.isEmpty()) {
        return EmptyIterator.<E>emptyIterator();
    }
    final IteratorChain<E> chain = new IteratorChain<E>();
    for (final Collection<E> item : all) {
        chain.addIterator(item.iterator());
    }
    return chain;
}
项目:HCFCore    文件:AbstractMultiValuedMap.java   
@Override
public Iterator<V> iterator() {
    final IteratorChain<V> chain = new IteratorChain<V>();
    for (final K k : keySet()) {
        chain.addIterator(new ValuesIterator(k));
    }
    return chain;
}
项目:HCFCore    文件:MultiValueMap.java   
@Override
public Iterator<V> iterator() {
    final IteratorChain<V> chain = new IteratorChain<V>();
    for (final K k : keySet()) {
        chain.addIterator(new ValuesIterator(k));
    }
    return chain;
}
项目:HCFCore    文件:CompositeSet.java   
/**
 * Gets an iterator over all the sets in this composite.
 * <p>
 * This implementation uses an <code>IteratorChain</code>.
 *
 * @return an <code>IteratorChain</code> instance which supports
 *  <code>remove()</code>. Iteration occurs over contained collections in
 *  the order they were added, but this behavior should not be relied upon.
 * @see IteratorChain
 */
public Iterator<E> iterator() {
    if (all.isEmpty()) {
        return EmptyIterator.<E>emptyIterator();
    }
    final IteratorChain<E> chain = new IteratorChain<E>();
    for (final Set<E> item : all) {
        chain.addIterator(item.iterator());
    }
    return chain;
}
项目:HCFCore    文件:CompositeCollection.java   
/**
 * Gets an iterator over all the collections in this composite.
 * <p>
 * This implementation uses an <code>IteratorChain</code>.
 *
 * @return an <code>IteratorChain</code> instance which supports
 *  <code>remove()</code>. Iteration occurs over contained collections in
 *  the order they were added, but this behavior should not be relied upon.
 * @see IteratorChain
 */
@Override
public Iterator<E> iterator() {
    if (all.isEmpty()) {
        return EmptyIterator.<E>emptyIterator();
    }
    final IteratorChain<E> chain = new IteratorChain<E>();
    for (final Collection<E> item : all) {
        chain.addIterator(item.iterator());
    }
    return chain;
}
项目:HCFCore    文件:AbstractMultiValuedMap.java   
@Override
public Iterator<V> iterator() {
    final IteratorChain<V> chain = new IteratorChain<V>();
    for (final K k : keySet()) {
        chain.addIterator(new ValuesIterator(k));
    }
    return chain;
}
项目:sakai    文件:MySession.java   
/**
 * @inheritDoc
 */
public Enumeration getAttributeNames()
{
    Set<String> nonPortableAttributeNames = m_nonPortalSession.getAllAttributes().keySet();
    IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),nonPortableAttributeNames.iterator());
    return new IteratorEnumeration(ic);
}
项目:sakai    文件:MySession.java   
/**
 * @inheritDoc
 */
public Enumeration getAttributeNames()
{
    Set<String> nonPortableAttributeNames = m_nonPortalSession.getAllAttributes().keySet();
    IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),nonPortableAttributeNames.iterator());
    return new IteratorEnumeration(ic);
}
项目:jgs    文件:TypeDomain.java   
/**
 * Enumerates all types by prepending "pub" and "dyn" to the security
 * domain. Thus, this method only works if the security domain is also
 * enumerable.
 */
public Iterator<TypeView<Level>> enumerate() {
    final TypeDomain<Level> self = this;
    Iterator<TypeView<Level>> secLevels =
            new TransformIterator<>(this.secDomain.enumerate(), new Transformer<Level, TypeView<Level>>() {
                @Override
                public TypeView<Level> transform(Level level) {
                    return self.level(level);
                }
            });
    return new IteratorChain<>(Arrays.asList(this.pub(), this.dyn()).iterator(),
                               secLevels);
}
项目:sakai    文件:MyLittleSession.java   
/**
 * @inheritDoc
 */
public Enumeration getAttributeNames()
{
    IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),m_nonPortalSession.getAllAttributes().keySet().iterator());
    return new IteratorEnumeration(ic);
}
项目:sakai    文件:MyLittleSession.java   
/**
 * @inheritDoc
 */
public Enumeration getAttributeNames()
{
    IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),m_nonPortalSession.getAllAttributes().keySet().iterator());
    return new IteratorEnumeration(ic);
}
项目:terminal-recall    文件:PredicatedORCollectionActionFilter.java   
@Override
public Iterator<E> iterator() {
    return UnmodifiableIterator.decorate(new IteratorChain(Arrays.asList(used.iterator(),unused.iterator())));
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through two {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @param iterator1  the first iterator to use, not null
 * @param iterator2  the second iterator to use, not null
 * @return a combination iterator over the iterators
 * @throws NullPointerException if either iterator is null
 */
public static <E> Iterator<E> chainedIterator(final Iterator<? extends E> iterator1,
                                              final Iterator<? extends E> iterator2) {
    // keep a version with two iterators to avoid the following warning in client code (Java 5 & 6)
    // "A generic array of E is created for a varargs parameter"
    return new IteratorChain<E>(iterator1, iterator2);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through two {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @param iterator1  the first iterator to use, not null
 * @param iterator2  the second iterator to use, not null
 * @return a combination iterator over the iterators
 * @throws NullPointerException if either iterator is null
 */
public static <E> Iterator<E> chainedIterator(final Iterator<? extends E> iterator1,
                                              final Iterator<? extends E> iterator2) {
    // keep a version with two iterators to avoid the following warning in client code (Java 5 & 6)
    // "A generic array of E is created for a varargs parameter"
    return new IteratorChain<E>(iterator1, iterator2);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through an array of {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @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 <E> Iterator<E> chainedIterator(final Iterator<? extends E>... iterators) {
    return new IteratorChain<E>(iterators);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through a collections of {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @param iterators  the iterators to use, not null or empty or contain nulls
 * @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 <E> Iterator<E> chainedIterator(final Collection<Iterator<? extends E>> iterators) {
    return new IteratorChain<E>(iterators);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through an array of {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @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 <E> Iterator<E> chainedIterator(final Iterator<? extends E>... iterators) {
    return new IteratorChain<E>(iterators);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that iterates through a collections of {@link Iterator}s
 * one after another.
 *
 * @param <E> the element type
 * @param iterators  the iterators to use, not null or empty or contain nulls
 * @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 <E> Iterator<E> chainedIterator(final Collection<Iterator<? extends E>> iterators) {
    return new IteratorChain<E>(iterators);
}