• magic_lobster_party@fedia.io
    link
    fedilink
    arrow-up
    7
    ·
    1 month ago

    For me I have the habit of doing findFirst because determinism is important where I work. But I agree with you if determinism is not of importance.

    • MagicShel@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      1 month ago

      I would only note that for the vast majority of my experience these streams can only return up to a single match. Determinism isn’t really preserved by findFirst, either, unless the sort order is set up that way.

      Finding the first Jim Jones in a table is no more reliable that finding any Jim Jones. But finding PersonId 13579 is deterministic whether you findFirst or findAny.

      Perhaps you work in a different domain where your experience is different.