Java Collections Tutorial 03 | List - Vector in java | java9s.com

Опубликовано: 05 Апрель 2016
на канале: java9s
7,866
57

https://java9s.com
In this short presentation, i am going to talk about some differences between ArrayList and Vector.
If you take a look at their Hierarchies, both of them implement List and Collection interfaces. So, they both offer same functionality.
Infact Vector was the first implementation of the List and was introduced in Java 1.0 and ArrayList was introduced later in Java 1.2 or what is called as Java 2.0
So, what was the need to introduce ArrayList to the Collections, when Vector was already available for us.
This is where a most frequently asked interview question raises. What is the difference between a Vector and ArrayList?
Vector is thread safe and ArrayList is not.
ArrayList can be manipulated by multiple threads
vector allows only one thread to modify elements at any given time.

arraylist tries to grow by half of its size.But vector grows double in size whenever we try to add something
ArrayList is used in applications where multiple threads are needed. That is the reason why all the Java Enterprise Edition projects use ArrayList.


На этой странице сайта вы можете посмотреть видео онлайн Java Collections Tutorial 03 | List - Vector in java | java9s.com длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь java9s 05 Апрель 2016, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 7,866 раз и оно понравилось 57 зрителям. Приятного просмотра!