io.kroxylicious.proxy.config.model.VisitableMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kroxylicious-integration-test-support Show documentation
Show all versions of kroxylicious-integration-test-support Show documentation
Support code to simplify writing integration tests for filters
package io.kroxylicious.proxy.config.model;
import java.util.stream.Collectors;
import java.lang.Iterable;
import java.util.function.Consumer;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Iterator;
import java.lang.Object;
import java.util.List;
import java.lang.String;
import java.util.Spliterator;
public class VisitableMap extends HashMap>> implements Iterable>{
public List> get(Object key) {
if (!containsKey(key)) {
put(String.valueOf(key), new ArrayList());
}
return super.get(key);
}
public List> aggregate() {
return values().stream().flatMap(l -> l.stream()).collect(Collectors.toList());
}
public Iterator> iterator() {
return aggregate().iterator();
}
public void forEach(Consumer super Visitable>> action) {
aggregate().forEach(action);
}
public Spliterator spliterator() {
return aggregate().spliterator();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy