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

io.kroxylicious.proxy.config.model.VisitableMap Maven / Gradle / Ivy

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> action) {
    aggregate().forEach(action);
  }
  
  public Spliterator spliterator() {
    return aggregate().spliterator();
  }
  

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy