0% found this document useful (0 votes)
65 views4 pages

List List1 New Arraylist 2. List List2 New Linkedlist 3. List List3 New Vector

1. Various Java collection classes are used to store ordered or unordered collections of objects. These include List, Set, Queue, Deque, and their implementations like ArrayList, LinkedList, HashSet, TreeSet. 2. List implementations allow duplicate elements and maintain insertion order. Set implementations do not allow duplicates. Queue and Deque deal with first-in-first-out and double-ended queue operations respectively. 3. Each collection class has specific properties like ordering, synchronization, and capabilities to add or remove elements from one or both ends. These determine which class to use for different data storage needs in a program.

Uploaded by

havichavvakula5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views4 pages

List List1 New Arraylist 2. List List2 New Linkedlist 3. List List3 New Vector

1. Various Java collection classes are used to store ordered or unordered collections of objects. These include List, Set, Queue, Deque, and their implementations like ArrayList, LinkedList, HashSet, TreeSet. 2. List implementations allow duplicate elements and maintain insertion order. Set implementations do not allow duplicates. Queue and Deque deal with first-in-first-out and double-ended queue operations respectively. 3. Each collection class has specific properties like ordering, synchronization, and capabilities to add or remove elements from one or both ends. These determine which class to use for different data storage needs in a program.

Uploaded by

havichavvakula5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Collection

List(I) Can have ordered collection of objects; can have duplicate values

1. List <data-type> list1= new ArrayList();  
ArrayList
LinkedList 2. List <data-type> list2 = new LinkedList();  

3. List <data-type> list3 = new Vector();  
Vector

4. List <data-type> list4 = new Stack();  

Stack

Queue(I)

PriorityQueue

Deque can remove and add the elements from both the side
ArrayDeque implements the Deque interface

Set(I)
HashSet Set<data-type> s1 = new HashSet<data-type>();
LinkedHashSet Set<data-type> s2 = new LinkedHashSet<data-type>();
SortedSet SortedSet<data-type> set = new TreeSet();
TreeSet Set<data-type> s3 = new TreeSet<data-type>();
dynamic array to store the duplicate element of different data types
can store the duplicate elements
Vector uses a dynamic array to store the data elements. It is
similar to ArrayList

stack is the subclass of Vector

an ordered list

holds the elements or objects which are to be processed by their


priorities. PriorityQueue doesn't allow null values to be stored in the
queue
a double-ended queue which enables us to perform the operations at
both the ends
an add or delete the elements from both the ends

store at most one null value in Set


represents the collection that uses a hash table for storage
permits null elements
provides a total ordering on its elements
j86ghju
maintains the insertion order and is non-synchronized.
maintains the insertion order and is not synchronized
It is synchronized and contains many methods that are not the part of
Collection framework

It implements the last-in-first-out data structure, i.e., Stack

maintains the first-in-first-out order

a double-ended queue which enables us to perform the operations at both the ends
ArrayDeque is faster than ArrayList and Stack and has no capacity restrictions.

unordered set of elements which doesn't allow us to store the duplicate items
It contains unique items
also contains unique elements and maintains the insertion order
elements of the SortedSet are arranged in the increasing (ascending) order
contains unique elements and elements in TreeSet stored in ascending order
elements stored can be randomly accessed
the manipulation is fast because no shifting is required.

The stack contains all of the methods of Vector class and also
provides its methods like boolean push(), boolean peek(),
boolean push(object o), which defines its properties.

It facilitates us to use the Deque

Hashing is used to store the elements in the HashSet

You might also like