All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zipkin2.storage.cassandra.internal.call.IntersectMaps Maven / Gradle / Ivy

There is a newer version: 3.4.2
Show newest version
/*
 * Copyright The OpenZipkin Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package zipkin2.storage.cassandra.internal.call;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import zipkin2.Call;
import zipkin2.internal.AggregateCall;

public final class IntersectMaps extends AggregateCall, Map> {

  public IntersectMaps(List>> calls) {
    super(calls);
  }

  @Override protected Map newOutput() {
    return new LinkedHashMap<>();
  }

  boolean firstInput = true;

  @Override protected void append(Map input, Map output) {
    if (firstInput) {
      firstInput = false;
      output.putAll(input);
    } else {
      output.keySet().retainAll(input.keySet());
    }
  }

  @Override public IntersectMaps clone() {
    return new IntersectMaps<>(cloneCalls());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy