edu.stanford.protege.webprotege.hierarchy.PathCollector Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.hierarchy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2021-04-21
*/
public class PathCollector implements Collector, Path> {
@Override
public Supplier> supplier() {
return ArrayList::new;
}
@Override
public BiConsumer, N> accumulator() {
return List::add;
}
@Override
public BinaryOperator> combiner() {
return (firstList, secondList) -> {
firstList.addAll(secondList);
return firstList;
};
}
@Override
public Function, Path> finisher() {
return Path::new;
}
@Override
public Set characteristics() {
return Collections.emptySet();
}
public static PathCollector toPath() {
return new PathCollector<>();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy