Example usage for com.google.common.collect ImmutableMultiset.Builder addAll

List of usage examples for com.google.common.collect ImmutableMultiset.Builder addAll

Introduction

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

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:org.apache.aurora.scheduler.filter.AttributeAggregate.java

public void updateAttributeAggregate(IHostAttributes attributes) {
    // If the aggregate supplier has not been populated there is no need to update it here.
    // All tasks attributes will be picked up by the wrapped task query if executed at a
    // later point in time.
    if (isInitialized) {
        final Supplier<Multiset<Pair<String, String>>> previous = aggregate;
        aggregate = Suppliers.memoize(() -> {
            ImmutableMultiset.Builder<Pair<String, String>> builder = new ImmutableMultiset.Builder<>();
            builder.addAll(previous.get());
            addAttributes(builder, attributes.getAttributes());
            return builder.build();
        });/*w w w. j  ava  2s  .c  om*/
    }
}