forEach on HashMap and IdentityHashMap (original) (raw)

Dawid Weiss dawid.weiss at gmail.com
Wed Jun 12 10:36:10 UTC 2013


default void forEach(BiConsumer<? super K, ? super V> sink) {

It would be nice to specify it as in here:

http://labs.carrotsearch.com/download/hppc/0.4.1/api/com/carrotsearch/hppc/ObjectObjectOpenHashMap.html#forEach(T)

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



More information about the core-libs-dev mailing list