Collection Framework
| Class Name | Duplicate Allowed | Null Insertion | Order of Insersion Maintained | Index/Hashcode | Default capacity | Data Structure |
|---|---|---|---|---|---|---|
| Arraylist | ✓ | ✓ | ✓ | Index | ✓ 10 | Re-sizable data structure |
| Vector | ✓ | ✓ | ✓ | Index | ✓ 10 | Doubly Data Structure |
| Linked List | ✓ | ✓ | ✓ | Index | X | Linear Data Structure |
| Hash Set | X | ✓ | X | Hash Code | X | Hash Table Data Structure |
| Linked HashSet | X | ✓ | ✓ | Hash Code | X | Hybrid Data Structure |
| Tree Set | X | X | X | Hash Code | X | Balanced Data Structure |
| Priority Queue | ------ | ------ | ------ | ------ | ------ | ------ |
Collection Framework
-->Collection: Collection is a frame used to perform Insertion and retrieval operation of an unique element as an single entity.-->If you want to represent unique type of single element as an single group or single entity then we should go for collection framework.
-->Collection is extended versions of array class.
-->Collection Framework is designed using Array foundations.
-->To overcome from the drawback which are present in Array, Collection Framework is designed.
-->Collection uses a container to store unique type of element.
-->Collection container is nitrogenous in nature.
-->It is growable in nature.
1. List(I):
-->List is a sub-interface of Collection Interface.
-->List is used to store unique type of element.
-->Insertion of elements are maintain with Index number.
-->'Null Insertion' is allowed.
-->Duplicate Insertion is also allowed
-->List Interface is implemented by three classes, They are:-
- 1. Array List
- 2. Vector
- 3. Linked List
1. Array List:-
Array list is implementation class of list interface.
Programmer can make use of Array list by importing a class present inside java.util package.
Below statement is used to create Object of Array list.
Syntax:
ArrayList al=new ArrayList(); index (0 to 9)
0 argument or argument
-->Index based operation takes place in ArrayList
-->The default capacity of ArrayList is 10.
-->If the elements are exceeded by 10 then automatically below formula is going to get executed and single index will be joined to current object.
New Capacity=(current capacity*3/2)+1
-->Objects are inserted in sequential way, ie insertion order is maintain.
-->Null insertion is allowed.
-->Duplicate Insertion is allowed.
-->Data structure used in ArrayList is resizable array data structure.
-->Insertion Operation and retrieval operation is faster.
-->Manupulation operation shouldn't perfomed.


Comments
Post a Comment