what is difference between set and list in collection?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
How to pass arraylist to stored procedure in java?
can we overload main method?
Does list maintain insertion order java?
What is basic concept of static in java ?
What is audio clip interface? Name few methods of it ?
What is meant by string is immutable?
What is “try and catch” in java
In how many ways we can do synchronization in java?
in a console we r giving java <class name> if r pressing enter where it'll goes
Why does java not support pointers?
If a multi threaded Java program has started numerous number of threads, at any point in time how to know which thread is currently executing/running ?
7 Answers Accenture, College School Exams Tests, iFlex, NIIT,
What is length in java?