Skip to content
Related Articles

Related Articles

When to use Array over a List?

View Discussion
Improve Article
Save Article
  • Last Updated : 07 Jun, 2022

Array: Array is a linear data structure that is the collection of similar data types.  Arrays are static data structures with fixed sizes.  Arrays are stored in the contiguous memory allocation. 

An example of Array

An example of an Array

Lists in python: In a simple language, a list is a collection of things. Lists are the simplest containers that are an integral part of the Python language. They need not be homogeneous always which makes it the most powerful tool in Python. Lists are a useful tool for preserving a sequence of data and further iterating over it.

ArrayLists in Java: ArrayList is a part of the collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed.

When arrays are used over a list in Java:

  • When we require a multidimensional structure to store the data then we use arrays over lists as lists can be one dimensional only.
  • If we require fixed length and static allocation then, arrays are used over lists.
  • When the faster processing of data is required then arrays are used over lists.
  • Primitive data types can be stored in arrays directly but not in lists so, we use arrays over lists.

When arrays are used over a list in Python:

  • We use arrays over lists in python as it requires less memory.
  • Arrays are faster than the list in python.
  • Arrays can directly handle arithmetic operations while lists cannot. So we use arrays over lists.
  • Arrays are preferred over lists for a longer sequence of data items.
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!