A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit.
Whenever You want to work on more than one objects you can use Collection.
ex- suppose I have 30 students and I want to send sms to all students.
I want to keep all 30 students in a single unit, so I will use collection, and I can transfer that single unit each and every where.
and If we talk about API of Collection Framework.
In above diagram you can see various Interfaces.
Collection
Set
List
----------
---------
Set- a collection that cannot contain duplicate elements.
List-an ordered collection (sometimes called a sequence).
Next day we will learn what are those classes which implements these above Interfaces, and How we will use Collection in our Programs.
Whenever You want to work on more than one objects you can use Collection.
ex- suppose I have 30 students and I want to send sms to all students.
I want to keep all 30 students in a single unit, so I will use collection, and I can transfer that single unit each and every where.
and If we talk about API of Collection Framework.
Collection
— the root of the collection hierarchy. A collection represents a group of objects known as its elementsIn above diagram you can see various Interfaces.
Collection
Set
List
----------
---------
Set- a collection that cannot contain duplicate elements.
List-an ordered collection (sometimes called a sequence).
Queue
— a collection used to hold multiple elements prior to processing.Deque
— a collection used to hold multiple elements prior to processing. Besides basic Collection
operations, a Deque
provides additional insertion, extraction, and inspection operations.
Map
— an object that maps keys to values. A Map
cannot contain duplicate keys; each key can map to at most one value.SortedSet
— a Set
that maintains its elements in ascending order.SortedMap
— a Map
that maintains its mappings in ascending key order. This is the Map
analog of SortedSet
. Sorted maps are used for naturally ordered collections of key/value pairs, such as dictionaries and telephone directories.
Easy way to learn collection
ReplyDelete