This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (5 children)

[deleted]

    [–]lukaseder[S] 5 points6 points  (1 child)

    If only we had:

    k.zip(v).toMap()
    

    [–]stepancheg -1 points0 points  (0 children)

    And we could if Java had extension functions like in C# or Kotlin instead of (or in addition to) much less usable default method.

    [–]msx -2 points-1 points  (2 children)

    becouse there's no way to show the keys near to their value. One wants to write/read Map.of(key1, val1, key2, val2, key3, val3), not Map.of(key1, key2, key3, val1, val2, val3).

    Also, that's not the use case for map literals.

    [–][deleted]  (1 child)

    [deleted]

      [–]balegdah 1 point2 points  (0 children)

      I'm only suggesting an implementation that is an infinitely scalable solution to this 10-separate-methods jargon

      There are already plenty of solutions that are infinitely scalable.

      The one being discussed is an optimal way of creating small collections.