Ad
  • Custom User Avatar

    Great solution!

    But I think, it has one sneaky problem.
    Your takeS will actually compute one more element than needed. This might be a problem, i.e. if the stream is exausted.