jp.skypencil.guava.stream.MultisetCollector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of helper Show documentation
Show all versions of helper Show documentation
Helper classes to help Java8 to collaborate with Guava
The newest version!
package jp.skypencil.guava.stream;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Supplier;
import java.util.stream.Collector;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
abstract class MultisetCollector>
implements Collector, R> {
@Override
public Supplier> supplier() {
return HashMultiset::create;
}
@Override
public BiConsumer, T> accumulator() {
return Multiset::add;
}
@Override
public BinaryOperator> combiner() {
return (set, another) -> {
set.addAll(another);
return set;
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy