3/27/2007

Comparing Arrays, Lists, and Maps

Generally when we tend to use either Arryalist/ Vector based on the basic requirement if that has to be synchronized or not. Other than that we minimally consider the responsiveness of the algorithmic implementation for each at the requirements.

For example: if we know there will be 10 objects that we need to store and iterated every time. Given the fancy of API we normally tend to use ArrayList / Vector irrespective of thinking of Array which is more powerful and very good implementation for known size.

There are several other parameters we might need to understand as developers which implementation that we need to choose based on the requirements. Some of them could be

1. Insert elements at the end of a list
2. Insert elements in the beginning of a list
3. Insert elements at random positions in a list
4. Access elements from the first to the last
5. Access elements from the last to the first
6. Access elements in random order
7. Update elements in random order


Here is an excellent article that explains the collection on a case to case basis

1 comment:

Arun said...

This article gives an exhaustive study on the performance of collections. In fact this site is one awesome resource.

Arun
http://www.arunma.com

Tired of seeing that 500 Bad gateway error while deploying a Springboot application in AWS...?

By default, Spring Boot applications will listen on port 8080. Elastic Beanstalk assumes that the application will listen on port 5000. Th...