Тёмный
No video :(

What is the difference between ArrayList and HashSet in Java (Core Java Interview Question  

QAFox
Подписаться 98 тыс.
Просмотров 208
50% 1

In this session, I have explained and practically demonstrated the difference between ArrayList and HashSet in Java. ArrayList and HashSet are the pre-defined classes in Java under Collection Framework. ArrayList has indexing concept, where the elements stored into the ArrayList will stored starting with the index 0, in a pre-served order and duplicates will be allowed as they can be differentiated with the index. Hence in ArrayList, the order in which the elements got added to the ArrayList is saved in the same order in the memory. Because of indexing concept in ArrayList, the duplicate elements will be having different indexes, hence duplicate elements will be considered as different elements. We can access the individual elements of the ArrayList using their index using get(index) method. We can use traditional for loop with ArrayList due to its indexing concept. And also the parent interface of ArrayList is List interface. Coming to HashSet, it doesn't have any indexing concept. Duplicates are not allowed in HashSet. Elements will be stored in random order in HashSet. There is not get() command or method to retrieve the elements from the HashSet individually. We cannot use traditional for loop with HashSet. And also the parent interface of HashSet is Set interface. All the above differences between ArrayList and HashSet explained above are demonstrated practically using Java programs in this session.
What is the difference between ArrayList and HashSet in Java (Core Java Interview Question #504)
For any doubts, live training updates, internship program and free Courses, please join our Telegram channel t.me/qafoxorig...
View Notes Here - docs.google.co...
Find all free full courses on Software Testing and Tools here - www.linkedin.c...
Visit our website for more details here - www.qafox.com/

Опубликовано:

 

19 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@QAFox
@QAFox Месяц назад
For any doubts, live training updates, internship program and free Courses, please join our Telegram channel t.me/qafoxoriginal
Далее
Set and HashSet in Java - Full Tutorial
20:43
Просмотров 211 тыс.
Python 3.12 Generics in a Nutshell
6:22
Просмотров 49 тыс.
Generics In Java - Full Simple Tutorial
17:34
Просмотров 1 млн
Java Roadmap for 2024
11:28
Просмотров 146 тыс.