0% found this document useful (0 votes)
3 views

CollectionsNotes

The document discusses the differences between legacy classes (like Vector and Stack) and the collections framework introduced in Java 1.2. It outlines the limitations of arrays, such as fixed size and homogeneous data types, compared to the growable and versatile nature of collections. Additionally, it describes key interfaces of the collections framework, including Collection, List, Set, and Queue, highlighting their characteristics and behaviors.

Uploaded by

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

CollectionsNotes

The document discusses the differences between legacy classes (like Vector and Stack) and the collections framework introduced in Java 1.2. It outlines the limitations of arrays, such as fixed size and homogeneous data types, compared to the growable and versatile nature of collections. Additionally, it describes key interfaces of the collections framework, including Collection, List, Set, and Queue, highlighting their characteristics and behaviors.

Uploaded by

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

## Note : Vector and Stack classes came in 1.

0 version of java while the


collections frame work came in 1.2 version of java . so these classes are known as
Legacy Classes.

Legacy Class : Vector ,Stack, TreeSet.

Arrays :-

Limitations of Arrays

1. Fixed in size .
2. Can hold only homogeneous data type element.
for hetrogenous data with have to take Object Array.
3. No underline dataStructure (readymade method support not possible).

Collection

1. Growable in nature .
2. Can hold both Homogeneous and heterogeneous objects.
3. Standard Data Sturcture (ReadyMade Method support are there).

Diffrences between Arrays and Collections

Array
1. Fixed in Size but collections are growable in nature
2. With respect memory arrays are not remmomemded but collections are recommened
to use.
3. Performance wise Arrays are good but collections are not .
4. Array can hold only Homogeneous but collections can hold both homo and hetro .
5. Underline DataStructure not avaible but in Collection there is standard DS.
6. primitives and objects both can be hold but in Collection only objects can be
hold.

Collection Vs Collections

Collection is interface while Collections is a class that provide Utilities for


Collection object.
Collection:
Collection is group of individual objects.
Collec

Nine Key Interfaces of Collection FrameWork.

1. Collection
2. List
Duplicate records are allowed and Insertion order is preserved.
List<Integer> list=new Stack<Integer>();
list=new LinkedList<Integer>();
list=new Vector<Integer>();
list=new ArrayList<Integer>();
3. Set
Duplicate records are not allowed and insertion order is not preserved.

Set<Integer> set= new HashSet<Integer>();


set=new LinkedHashSet<Integer>();
4. SortedSet

Dupilcates are not allowed but elements are inserted in sorted order.

5. NavigableSet

Child Interface of SortedSet.


NavigableSet<Integer> navigableSet= new TreeSet<Integer>();

6. Queue

You might also like