Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 184.108.40.206 release ready!
Owner and Founder. Opencart
According to Apple:
A collection containing the same elements as a Base collection, but on which some operations such as map and filter are implemented lazily
Lazy collections are used to compute a collection lazily i.e compute value when requested. It will helps in getting rid of intermediate array creation.
In the above playground example as you can see there are 2 same sets of operations are happing on the list. But there is one minor difference i.e on the 2nd list we are using the lazy property. It helps in reducing the computation time significantly. The lazy property is a LazySequence<T> type. The LazySequence contains the same element as the sequence. But on this, some operations such as map and filter are implemented lazily.
Now as you have seen lazy property performance, let’s talk about its limitations:
The output of this is not stored in the array. Hence all these modifiers will execute for each and every request.
Do not use lazy property every time when you use a collection. For example, if your collection contains 10 items then there is no need for you to applying lazy property. As there will be no performance gain for this case.
Thank you for reading this article. If you want to read more articles regarding iOS Development click here. And if you want to know more about lazy collection then click here.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.