Skip to content

Instantly share code, notes, and snippets.

@amaembo
Last active December 28, 2015 16:29
Show Gist options
  • Save amaembo/ac2c512a8b6898a7625c to your computer and use it in GitHub Desktop.
Save amaembo/ac2c512a8b6898a7625c to your computer and use it in GitHub Desktop.
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
public class TestMap<E> {
public void mapMethod(Consumer<? super E> defaultConsumer) {
Map<Object, Consumer<? super E>> map = new HashMap<>();
Consumer<? super E> consumer = map.entrySet()
.stream()
.filter(x -> true)
.map(Map.Entry::getValue)
.findAny()
.orElse(defaultConsumer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment