Chain-of-responsibility pattern: Difference between revisions

Content deleted Content added
m updated flow of example
m Java example: clearer variable name
Line 77:
}
 
static Logger logger(LogLevel[] levels, Consumer<String> writeMessagestringConsumer) {
EnumSet<LogLevel> set = EnumSet.copyOf(Arrays.asList(levels));
return (msg, severity) -> {
if (set.contains(severity)) {
writeMessagestringConsumer.accept(msg);
}
};