Example usage for org.apache.commons.collections IteratorUtils chainedIterator

List of usage examples for org.apache.commons.collections IteratorUtils chainedIterator

Introduction

In this page you can find the example usage for org.apache.commons.collections IteratorUtils chainedIterator.

Prototype

public static Iterator chainedIterator(Collection iterators) 

Source Link

Document

Gets an iterator that iterates through a collections of Iterator s one after another.

Usage

From source file:de.awtools.config.CombinedGlueConfig.java

@SuppressWarnings("unchecked")
public Iterator<String> getKeyIterator() {
    @SuppressWarnings("rawtypes")
    Iterator[] iterators = new Iterator[configs.size()];
    int index = 0;
    for (GlueConfig gc : configs) {
        iterators[index] = gc.getKeyIterator();
        index++;/*from www .ja va2  s.  c o m*/
    }
    return (IteratorUtils.chainedIterator(iterators));
}

From source file:org.optaplanner.core.impl.domain.valuerange.buildin.composite.CompositeValueRange.java

@Override
public Iterator<T> createOriginalIterator() {
    List<Iterator<T>> iteratorList = new ArrayList<Iterator<T>>(childValueRangeList.size());
    for (ValueRange<T> childValueRange : childValueRangeList) {
        iteratorList.add(childValueRange.createOriginalIterator());
    }//from   www  . ja v  a  2 s.c  om
    return IteratorUtils.chainedIterator(iteratorList);
}

From source file:org.wso2.carbon.analytics.dataservice.core.indexing.AnalyticsDataIndexer.java

@SuppressWarnings("unchecked")
private Record aggregatePerGrouping(int tenantId, String[] path, AggregateRequest aggregateRequest)
        throws AnalyticsException {
    Map<String, Number> optionalParams = new HashMap<>();
    Map<String, AggregateFunction> perAliasAggregateFunction = initPerAliasAggregateFunctions(aggregateRequest,
            optionalParams);// w ww .j  a v  a  2 s .c  o  m
    List<Iterator<Record>> iterators = this.getRecordIterators(tenantId, path, aggregateRequest);
    Record aggregatedRecord = null;
    if (!iterators.isEmpty()) {
        Iterator<Record> iterator = IteratorUtils.chainedIterator(iterators);
        while (iterator.hasNext()) {
            Record record = iterator.next();
            for (AggregateField field : aggregateRequest.getFields()) {
                Number value = (Number) record.getValue(field.getFieldName());
                AggregateFunction function = perAliasAggregateFunction.get(field.getAlias());
                function.process(value);
            }
        }
        Map<String, Object> aggregatedValues = generateAggregateRecordValues(path, aggregateRequest,
                perAliasAggregateFunction);
        aggregatedRecord = new Record(tenantId, aggregateRequest.getTableName(), aggregatedValues);
    }
    return aggregatedRecord;
}