Example usage for com.google.common.collect ImmutableList.Builder size

List of usage examples for com.google.common.collect ImmutableList.Builder size

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList.Builder size.

Prototype

int size();

Source Link

Document

Returns the number of elements in this list.

Usage

From source file:com.spotify.heroic.aggregation.Chain.java

@Override
public AggregationInstance apply(final AggregationContext context) {
    ListIterator<Aggregation> it = chain.listIterator(chain.size());

    AggregationContext current = context;
    final ImmutableSet.Builder<String> tags = ImmutableSet.builder();

    final ImmutableList.Builder<AggregationInstance> chain = ImmutableList.builder();

    while (it.hasPrevious()) {
        final AggregationInstance instance = it.previous().apply(current);
        tags.addAll(instance.requiredTags());
        current = current.withRequiredTags(tags.build());
        chain.add(instance);//from ww  w. j av  a  2s . c o m
    }

    return ChainInstance.fromList(Lists.reverse(chain.build()));
}