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

Collections Vector Stack LinkedList Set смотреть онлайн

📁 Лайфстайл 👁️ 16 📅 05.12.2023

In this video we discussed about different methods present in Vector, Stack, LinkedList and Set .
1. /*
* - Most of the methods in vector are synchronized
* - It is thread safe.
* - Relatively performance is low
* - Enumeration is used to iterate objects from Vector
* - Enumeration is applicable only for legacy classes
* - Enumeration does not have method to remove object
*
*
*/
package com.nadboy.collections;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;

import com.nadboy.utils.Employee;

public class VectorDemo {
public static void main(String[] args) {

Vector v = new Vector();
Vector v1 = new Vector(4); // Vector(int initialCapasity)
Vector v2 = new Vector(4,6); // Vector(int initialCapasity, int incremental capacity)
Vector v3 = new Vector(new ArrayList()); // Vector(Collection c)
v.add(new Employee(1, "ram", 345345345, "[email protected]", 23));

v.forEach(item - {System.out.println(item);});

Enumeration e = v.elements();

while(e.hasMoreElements()) {
System.out.println(e.nextElement());
}
}
}
2. . /*
* - Stack follows last in first out order.
*
*/
package com.nadboy.collections;

import java.util.Stack;

public class StackDemo {

public static void main(String[] args) {
Stack s = new Stack();
//s.peek() // it will return top element from the stack with out removing
//s.pop() // it will return top element and remove that object from stack
//s.push() // it will add an object to stack
//s.search(Object o) // return offset that means if the object is there then
// return position of the object otherwise return -1
//s.empty()

}

}

3. /*
* - For insertion and remove objects operation is frequent on any collection then we can go for
* linked list
*
*/
package com.nadboy.collections;

import java.util.LinkedList;

import com.nadboy.utils.Employee;

public class LinkedListDemo {

public static void main(String[] args) {

LinkedList l = new LinkedList();

LinkedList l1 = new LinkedList(l); // LinkedList(Collection c)
l.add(new Employee(1, "ram",2342, "[email protected]", 2));

//Object str= l.clone();

//Object poll(): It returns and removes the first item of the list
//Object pollFirst(): same as poll() method. Removes the first item of the list.
//Object pollLast(): It returns and removes the last element of the list.
// Object remove(): It removes the first element of the list.
// list.offer("ram"); // add element at the end
//list.offerFirst("ram"); //add element at the beginning
//list.offerLast("ram"); // add element at the last
}
}

4. /*
* - Set is a collection of similar or different type of objects.
* - Set will not allow duplicate objects
* - Set will not maintain the order of objects insertion.
* - HashSet and LinkedHashSet are child classes for Set.
* - SortedSet is the child interface of Set and it will maintain the insertion order.
* - NavigableSetis the child interface of SortedSet
* - TreeSet is the implementation class for NavigableSet.It will allow only similar type of objects.
* - Every collection class implements serializable and clonable interfaces.
* - Arraylist and Vector classes implements RandomAccess interface.
* - Hashset underline data structure is hashtable
*
*/
package com.nadboy.collections;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import com.nadboy.utils.Employee;

public class SetDemo {

public static void main(String args) {
//HashSet is best for search operation.
// insertion order is not preserved. inserted based on hash code of objects.
Set Employee set = new HashSet Employee ();
Employee emp = new Employee(1, "ram", 234, "[email protected]", 2);
//set.add("ram");
//set.add("ram");
set.add(emp);
set.add(emp); // It will not allow duplicated objects, if we add duplicate
// objects then it will just take only one objects
// for duplicate objects add() return false.
set.add(null);
set.add(null); // null insertion accepted but take only one.
// constructors for HashSet

HashSet h = new HashSet(); // initial capacity 16
// default fill ratio/load factor: 0.75
HashSet h1 = new HashSet(4); // initial capacity is 4, default fill ratio 0.75
HashSet h2 = new HashSet(4,0.9f); // initial capacity is 4 and fill ratio 0.9

HashSet h3 = new HashSet(new ArrayList()); // creates an equivalent hashset for the given collection

Set Employee linkedset = new LinkedHashSet Employee(); // It maintains insertion order.

SortedSet Employee sortedset = new TreeSet Employee ();
}

}

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Collections Vector Stack LinkedList Set» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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