Answer Posted / sumit
set-->
when uniqueness is required you need to implement set.
e.g.
HashSet(unOrd,unSort) Fast access, assures no duplicates,
provides no ordering.
LinkedHashSet(Ord,unSort)No duplicates; iterates by
insertion order.
TreeSet(ascending,naturalord)No duplicates ; iterates in
sorted order.
list-->
when ordered list is required you need to implement list.
e.g.
ArrayList(Ord,unSort)Fast iteration and fast random access.
Vector(syncronized)
LinkedList()Good for adding elements to the ends, i.e.,
stacks and queues.
| Is This Answer Correct ? | 91 Yes | 7 No |
Post New Answer View All Answers
Explain about fail safe iterators in java?
Does java set allow duplicates?
Explain about anonymous inner classes in java?
What is the base class for error and exception?
Why do we need singleton?
Can a class have 2 constructors?
What is the difference between static class and normal class?
Is java an open source?
How do you square a number?
What is externalizable?
When should I use stringbuffer?
what do you understand by synchronization? : Java thread
What best practices should you follow while writing multithreaded code in java?
What are different types of multitasking?
Can you run java program without main method?