Difference between Set and List Interface in JAVA
List
1.List an Ordered grouping of elements i.e.Maintain order of added Element(add the element in List and print on Consol).
2.List can contain duplicate elements
3.New methods are defined inside List interface.
Set
1.Is an Unordered grouping of elements.i.e.not Maintain order of added Element(add the element in List and print on Consol, Order is changed).
2.Set can contain Unique elements
3.No new methods are defined inside Set interface, so only use Collection interface methods only with Set subclasses.
List
1.List an Ordered grouping of elements i.e.Maintain order of added Element(add the element in List and print on Consol).
2.List can contain duplicate elements
3.New methods are defined inside List interface.
Set
1.Is an Unordered grouping of elements.i.e.not Maintain order of added Element(add the element in List and print on Consol, Order is changed).
2.Set can contain Unique elements
3.No new methods are defined inside Set interface, so only use Collection interface methods only with Set subclasses.
0 Comments