forEach on HashMap and IdentityHashMap (original) (raw)
Dawid Weiss dawid.weiss at gmail.com
Wed Jun 12 10:36:10 UTC 2013
- Previous message: forEach on HashMap and IdentityHashMap
- Next message: hg: jdk8/tl/jdk: 8015960: java/util/Locale/LocaleProviders.java failing again on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
default void forEach(BiConsumer<? super K, ? super V> sink) {
It would be nice to specify it as in here:
public <T extends BiConsumer<? super K,? super V>> T forEach(T sink)
funny as it looks, it allows the caller to create an anonymous class instance and get at its methods/ fields in a call chain.
int counted = map.forEach(new BiConsumer<X,Y>() { public int counter; // the rest of the implementation... }).counter;
Just a thought.
Dawid
- Previous message: forEach on HashMap and IdentityHashMap
- Next message: hg: jdk8/tl/jdk: 8015960: java/util/Locale/LocaleProviders.java failing again on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]