RUVIDEO
Поделитесь видео 🙏

#1.1 Java Collections Framework in Hindi | ArrayList Introduction

📁 Обучение 👁️ 17 📅 05.12.2023

Java Collections Framework : The Java Collections Framework is a
collection of interfaces and classes which helps in storing and processing the data efficiently. This framework has several useful classes which have tons of useful functions which makes a programmer task super easy.
Java Collections – Table of Contents
1. ArrayList
2. LinkedList
3. Vector
4. HashSet
5. LinkedHashSet
6. TreeSet
7. HashMap
8. TreeMap
9. LinkedHashMap
10. Hashtable
11. Iterator and ListIterator
12. Comparable and Comparator
_________________________________________________________________
1. ArrayList – Collections Framework : ArrayList class implements List interface and it is based on an Array data structure. It is widely used because of the functionality and flexibility it offers. Most of the developers choose ArrayList over Array as it’s a very good alternative of traditional java arrays. ArrayList is a resizable-array implementation of the List interface. It implements all optional list operations, and permits all elements, including null.
_______________________________________________________________
Why ArrayList is better than Array?
The limitation with array is that it has a fixed length so if it is full you cannot add any more elements to it, likewise if there are number of elements gets removed from it the memory consumption would be the same as it doesn’t shrink.
On the other ArrayList can dynamically grow and shrink after addition and removal of elements. Apart from these benefits ArrayList class enables us to use predefined methods of it which makes our task easy. Let’s see the diagrams to understand the addition and removal of elements from ArrayList.
__________________________________________________________________
Methods of ArrayList class :-
In the above example we have used methods such as add() and remove(). However there are number of methods available which can be used directly using object of ArrayList class. Let’s discuss few important methods of ArrayList class.
1). add( Object o) : This method adds an object o to the arraylist.
Example :-
obj.add(“hello”);

This statement would add a string hello in the arraylist at last position.
2). add(int index, Object o) : It adds the object o to the array list at the given index.
Example :-
obj.add(2, “Rakesh”);
It will add the string bye to the 2nd index (3rd position as the array list starts with index 0) of array list.
3). remove(Object o) : Removes the object o from the ArrayList.
Example :-
obj.remove(“Ravi”);
This statement will remove the string “Chaitanya” from the ArrayList.
4) remove(int index) : Removes element from a given index.
Example :
obj.remove(3);
It would remove the element of index 3 (4th element of the list – List starts with o).
5) set(int index, Object o) : Used for updating an element. It replaces the element present at the specified index with the object o.
Example :
obj.set(2, “Ravi”);
It would replace the 3rd element (index =2 is 3rd element) with the value Tom.
6) int indexOf(Object o) : Gives the index of the object o. If the element is not found in the list then this method returns the value -1.
Example :
int pos = obj.indexOf(“Ravi”);
This would give the index (position) of the string Tom in the list.
7) Object get(int index) : It returns the object of list which is present at the specified index.
Example : -
String str = obj.get(2);
Function get would return the string stored at 3rd position (index 2) and would be assigned to the string “str”. We have stored the returned value in string variable because in our example we have defined the ArrayList is of String type. If you are having integer array list then the returned value should be stored in an integer variable.
8) int size() : It gives the size of the ArrayList – Number of elements of the list.
Example : -
int numberofitems = obj.size();
9) boolean contains(Object o) : It checks whether the given object o is present in the array list if its there then it returns true else it returns false.
Example : -
obj.contains(“Ravi”);
It would return true if the string “Steve” is present in the list else we would get false.
10) clear() : It is used for removing all the elements of the array list in one go. The below code will remove all the elements of ArrayList whose object is obj.
Example : -
obj.clear();



#programminggalaxy #arraylistinjava
#arraylist #arraylistshortinjava

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «#1.1 Java Collections Framework in Hindi | ArrayList Introduction», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.