Collections vs Sequences in KOTLIN, which one you should prefer?

  1. Sequences are executed lazily when possible, computing happens only when the result of the whole processing chain is requested.
  2. Sequences perform all the processing steps one-by-one for every single element, instead of completing each step for the whole collection and then proceeds to the next step.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store