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 22.214.171.124 release ready!
Owner and Founder. Opencart
Let ‘s explore some of the often used data structure in Android application development. One of the most important factors that contribute to Android application development is memory, execution speed. Android system provides set of collections build especially for mobile development which in turn reflects in apps performance.
When size is fixed of element use arrays instead of ArrayList because internally ArrayList uses an array by default storage. Every time it reaches its maximum size ArrayList increases its the size to right bitwise shift of current value
newSize=oldSize + oldSize>>1.
Whenever we need to store key-value pair, Generally HashMap is first to strike our mind. Its quite easy and widely used but that’s not the case when it comes to Android. Similar to Arrays use EnumMap over HashMap when the keys are known. Iterating over a HashMap provides no guaranty of the order in which elements will be traversed. Say you are building a shopping cart and store the orders in a map of product -> quantity. The user now wants to see all the items in his cart. Since a HashMap is being used, the card would show all the items but the order would be random. Instead of using a LinkedHashMap is much better here, since you can iterate over it like a normal LinkedList.
Enum in Java is a data type that contains fixed set of constants. When we required the predefined set of values which represents some kind of data, we use ENUM. We always use Enums when a variable can only take one out of a small set of possible values. Each value in an ENUM is an object and each declaration will take some runtime memory simply to reference the object. So ENUM values will take more memory then Integer or String constant.
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.