Ad
  • Custom User Avatar

    Hi,

    It wasn't sarcastic at all as I was more interested in "how to do at with Streams at all" than "should it be done with streams?".

    Basically I struggled with "how to apply Java 8" in this case, so that is why I liked your solution.

  • Custom User Avatar

    I honestly can't tell if that's sarcastic, but I hope it is. I used streaming to keep my streaming knowledge fresh, not because it's remotely a good idea for this problem (you'll notice there's 0 Best Practices votes, not even one from me). Mapping each individual value into its own stream is particularly painful.

    And I bet the performance sucks, particularly because of .mapToObj(IntStream::of).

    The real Java solution for this is a simple for loop with iterations equal to the length of the longer array.

  • Custom User Avatar

    Very elegant use of Java 8.