Map enhancement

Pavel Rappo pavel.rappo at
Sat Jun 6 20:55:37 UTC 2015

May I ask what tangible value would be in that? As far as I understand with
lambda syntax whenever you have

    Map<K, V> m

and you want to use it in some context as a

    Function<? super K, ? extends V> f

you can simply write

    f = m::get

so syntactical overhead is minimal.

P.S. Let me point out that a map could be also seen as a collection of its
entries, a predicate for its keys and values

    Predicate<? super K> p1 = m::containsKey
    Predicate<? super V> p2 = m::containsValue

a bi-consumer for (k, v)

    BiConsumer<? extends K, ? extends V> c1 = m::put;

or a bi-function (though with side-effects)

    BiFunction<? super K, ? extends V, ? super V> f1 = m::put;

When we go down to this level of fundamental abstractions, everything could be
seen almost as everything else :)

> On 6 Jun 2015, at 20:30, Frederic Gendebien <frederic.gendebien at> wrote:
> Dears,
> I think it would be great to modify the Map<F, T> so it implements Function<F, T> as it is done in Scala. In fact, Mathematically, a map is function who takes an input parameter of type F and gives back a value of type T.
> Kind regards,
> Frederic Gendebien.

More information about the jdk9-dev mailing list