org.zalando.riptide.opentracing.span.HeaderExtractor Maven / Gradle / Ivy
package org.zalando.riptide.opentracing.span;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
import static java.lang.String.join;
final class HeaderExtractor {
Optional extract(
final Map> headers,
final List names) {
return names.stream()
.map(headers::get)
.filter(Objects::nonNull)
.filter(not(List::isEmpty))
.findFirst()
.map(list -> join("\n", list));
}
private static Predicate not(final Predicate predicate) {
return predicate.negate();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy