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

zipkin2.storage.cassandra.internal.call.IntersectKeySets 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.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import zipkin2.Call;
import zipkin2.internal.AggregateCall;

public final class IntersectKeySets extends AggregateCall, Set> {
  public IntersectKeySets(List>> calls) {
    super(calls);
  }

  @Override protected Set newOutput() {
    return new LinkedHashSet<>();
  }

  boolean firstInput = true;

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

  @Override public IntersectKeySets clone() {
    return new IntersectKeySets(cloneCalls());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy