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.
3 Comments
Basically, a list collection stores elements by insertion order (either at the end or at a specific position in the list). A list maintains indices of its elements so it allows adding, retrieving, modifying, removing elements by an integer index (zero-based index; the first element is at 0-index, the second at 1-index, the third at 2-index, and so on). The following picture illustrates a list that stores some String elements:
ReplyDeleteMore Info: selenium training centres in velachery | selenium training institutes in velachery
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletePython Training in electronic city
DataScience with Python Training in electronic city
AWS Training in electronic city
Big Data Hadoop Training in electronic city
Devops Training in electronic city
You are doing a good job and sharing your knowledge to others! it was one of the pretty post to read and useful to improve the knowledge as updated one, keep doing the good work.
ReplyDeleteSelenium Training in Electronic City