COSE.KeySetCollector Maven / Gradle / Ivy
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package COSE;
import java.util.Collections;
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;
public class KeySetCollector implements Collector {
@Override
public Supplier supplier() {
return KeySet::new;
}
@Override
public BiConsumer accumulator() {
return (acc, elem) -> acc.add(elem);
}
@Override
public BinaryOperator combiner() {
// parallel streams are not supported
return (acc1, acc2) -> {
throw new UnsupportedOperationException("parallel streams are not supported");
};
}
@Override
public Function finisher() {
return (acc) -> acc;
}
@Override
public Set characteristics() {
return Collections.emptySet();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy