Collections
Collections
Implementation Classes for List Interface Vector and Stack are know as Legacy Classes.
I don’t want
Duplicate
elements & I Solution is
also don’t
want to
preserve
insertion Set
order. Interface
Implementation Classes for Set are
HashSet and LinkedHashSet
Implementation Class for NavigableSet is TreeSet
Implementation Classes for Queue are PriorityQueue and BlockingQueue
Map is child
interface of
Collection
?
NO
Rahul
Kishan
Abhishek
Implementation Classes for Map are hashMap, WeakHashMap ….
vii. SortedMap (I)
Implementation Class for
NavigableMap is TreeMap
Overview of
Collection (I)
Interface
Methods:
Is there any get() method available to
retrieve object from collection?
List Methods:
Replacing an element
object
ArrayList Constructors:
Once ArrayList reaches its map capacity a new Array List will be created with new capacity
In Java In C++
Collection Container
Cloned S5
ArrayList
S3
S2
S2 S1
S1
S5
S5 Network
S3
S3 S4
S4
Interviewer
Yes
You
1. Best Choice:
1. The underlying data structure for Vector is resizable array or growable array.
7. Most of the methods present in Vector are synchronized. Hence, Vector object is Thread Safe.