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

Collection Theroy

The document discusses different collection interfaces in Java including List, Set, and Queue. It provides details on common List implementations like ArrayList, LinkedList, and Vector. It also covers Set implementations HashSet, LinkedHashSet, and TreeSet and their characteristics. Finally, it mentions the Queue interface and PriorityQueue implementation.

Uploaded by

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

Collection Theroy

The document discusses different collection interfaces in Java including List, Set, and Queue. It provides details on common List implementations like ArrayList, LinkedList, and Vector. It also covers Set implementations HashSet, LinkedHashSet, and TreeSet and their characteristics. Finally, it mentions the Queue interface and PriorityQueue implementation.

Uploaded by

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

Collections

Collection(I)

1. List(I)

2. set(I)

3. queue(I)

1. List(I)

a) duplicate are allowded in list

b) allows any no of null values

c) order of insertion-maintained

d) Storage type:Index

i) Arraylist(IC)

ii) vector(IC)------legacy

iii) LinkedList(IC)

Cursor:

1. Iterator-- all the collection object --universal curser

2. listIterator -- only for list interface type impl classes --not universal curser

3. enumeration -- legecy --not universal curser


1. Arraylist (IC)

1. Duplicate are allowed in Arraylist


2. Allows any no of null values
3. Order of insertion-maintained
4. Default capacity for arraylist is 10
5. Data structure: Resizable
6. Incremental capacity= (current capacity*3/2) +1
7. Best choice: retrieval operation (random access interface is implemented in arraylist
& vector)
8. Worst choice: manipulation operation i.e. insertion in between arraylist or delete ()
9. Storage type: index

2. Vector

1. Duplicate are allowed in vector


2. Allows any no of null values
3. Order of insertion-maintained
4. Default capacity of Vector is 10
*5. Data structure: doubly
*6. Incremental capacity= current capacity*2
7. Best choice: retrieval operation (random access interface is implemented in arraylist & vector)
8. Worst choice: manipulation operation i.e. insertion in between Vector or delete ()
*9. Vector is legacy class.
10. Storage type: index

3. LinkedList

1. Duplicate are allowed in LinkedList


2. Allows any no of null values
3. Order of insertion-maintained
* 4. No Default capacity in linkedlist
*5. Data structure: linear
*7. Best choice: manipulation operation i.e. insertion in between linkedlist or delete ()
*8. Worst choice: retrieval operation
9. Storage type: index
Arraylist Vector

1. Not legacy class 1. legacy class


2. DS: resizable 2. DS: doubly
3. I.C=(C.C.*3/2)+1 3. IC=CC*2
4. not-syncronised & not-thread safe 4. syncronised and thread-safe
5. Performance: high 5. Performance: low

Arraylist linkedList
1. Default capacity:10 1.no deafult capacity
2. DS: resizable 2.DS: linear
3. Best Choice:Retrival operation 3. best choice: manipulation
4. Worst choice: manipulation 4.Wrost choice:Retrival operation

2. Set(I):
a) doesn't allow duplicate

b) allow only 1 null value(except treeset)

c) order of insertion-random insertion, maintained, ascending

d) Storage type:Hashtable

i) Hashset(IC)

ii) LinkedHashset(IC)

iii) Treeset(IC)

1.Hashset:

1. Doesn't allow duplicate values


2. Allow only 1 null value.
3. Order of insertion-random insertion
4. No default capacity
5. DS: Hashtable
6. Storage type: hashtable
Best choice: To remove duplicate elements when order of insertion is not mandatory.
2. LinkedHashSet:

1. Doesn't allow duplicate values


2. Allow only 1 null value.
*3. Order of insertion-maintained
4. No default capacity
*5. DS: Hybrid (liner+ hashtable)
6. Storage type: hashtable
Best choice: To remove duplicate elements when order of insertion is mandatory

3. TreeSet:

1. Doesn’t allow duplicate


2. Null values: not allowed
*3. Order of insertion- Ascending order.
4. No default capacity.
5. DS: Balanced tree
6. Storage type: hashtable
Note: we can store only homogeneous data
Best choice: To remove duplicate elements when order of insertion Ascending order.

3. queue(I)

a) priorityQueue(IC)

Cursor:

1. Iterator—
a) Used to fetch data of all 7 implementation classes
b) It is also called as an universal curser
c) Can fetch data in forward direction only
d) Can perform read and remove operations
2. listIterator –
a) only for list interface type implementation classes
b) Can fetch data in forward direction and backward direction only
c) Can perform read , remove, replace and addition of an object operations
3. enumeration-
a) used to fetch data of vector class only
b) Can fetch data in forward direction only
c) Can perform read operation

You might also like