what is difference between set and list in collection?

Answers were Sorted based on User's Feedback



what is difference between set and list in collection?..

Answer / srinu

set:
1)set interface extended from collection interface
2)set does not allow duplicated values
3)set interface contain concreated classes(TreeSet,HashSet)
4)set interface retrive the data only forward Direction
only( only Iterator is their)
5)in set object add an element at end only
6)set interface contain one sub interface(sorted set)

List
1)List interface extended from collection interface.
2)List allows duplicated values
3)List interface contain concreated
classes(ArrayList,LinkedList)
4)in List object add an element at specific(dynamic)
insertion is possible
5)List interface retrive the data forward Direction and
backword directions(ListIterator is their)
6)List interface does not contain ony sub interface

Is This Answer Correct ?    36 Yes 2 No

what is difference between set and list in collection?..

Answer / harikrishna

set inter is used to represent unique elements where as in
list interface elements need not be unique ArrayList,
Vector and LinkeList implememts list interface.Hashset and
LinkedHastSet implements set interface

Is This Answer Correct ?    19 Yes 2 No

what is difference between set and list in collection?..

Answer / chris

Set does not permit duplicate elements, List does. Also, Set
does not guarantee any iteration order, whereas List does.

Is This Answer Correct ?    17 Yes 5 No

Post New Answer

More Core Java Interview Questions

What is the significance of continue jump statement? Explain with an example.

0 Answers   Amdocs,


Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?

0 Answers   HCL,


explain the concept of virtual method invocation in polymorphism in detail?

0 Answers   TCS,


What is keyword auto for?

0 Answers  


what is interface in java? Explain

0 Answers  






How Vector class is synchronized,How to build user defined class as synchronized?

0 Answers  


What is a newline character in java?

0 Answers  


What are the different http methods?

0 Answers  


Can constructor be inherited?

0 Answers  


Explain the transient field modifier?

0 Answers  


what is overloading in java?

13 Answers   Ascent, DNS, Infosys, SDA, VelTech,


What is the range of the char type?

3 Answers  


Categories