Example usage for com.google.common.collect ClassToInstanceMap putAll

List of usage examples for com.google.common.collect ClassToInstanceMap putAll

Introduction

In this page you can find the example usage for com.google.common.collect ClassToInstanceMap putAll.

Prototype

void putAll(Map<? extends K, ? extends V> m);

Source Link

Document

Copies all of the mappings from the specified map to this map (optional operation).

Usage

From source file:com.opengamma.strata.basics.market.ImmutableTypedReferenceData.java

@Override
public TypedReferenceData combinedWith(TypedReferenceData other) {
    ClassToInstanceMap<Object> combined = MutableClassToInstanceMap.create();
    combined.putAll(values);
    for (Class<?> type : other.types()) {
        combined.merge(type, other.getValue(type), (v1, v2) -> {
            if (v1.equals(v2)) {
                return v1;
            }//from  ww  w  .  jav  a2s .  c o  m
            throw new IllegalArgumentException(Messages.format(
                    "Unable to combine reference data, values differ for type '{}'", type.getSimpleName()));
        });
    }
    return ImmutableTypedReferenceData.of(combined);
}