assertions,Collections,Generics

What is the use of Assertions,Collections,Generics in java?I have gone through the SUN material also regarding these topics but it is yet not clear for me.Please help me.
[191 byte] By [ranjan1710a] at [2007-10-3 3:31:29]
# 1

Collection is used for storing objects ,data etc in a tree , linked list etc.

-> suppose u want 2 objects to be stored u use a linked list or a vector

Generics are templates

ie suppose u don't know the datatype of parameters that will be passed to a func

eg

1 swap(int a, int b)

2 swap (float a,float b)

3 swap(string a,string b)

where swap func swaps the value of a ,b in all 3 cases

u know that ur login for all the 3 cases is same but the parameters passed will be of different type(int ,float,string)

instead of using overloaded func and doing the reword

u can use generic template will will handle all of the data at runtime

vipuluckya at 2007-7-14 21:25:30 > top of Java-index,Java Essentials,Java Programming...
# 2

> Generics are templates

Not quite.

> ie suppose u don't know the datatype of parameters

Then Generics are not really what you need. Generics are used to specify the type.

> that will be passed to a func

> eg

> 1 swap(int a, int b)

> 2 swap (float a,float b)

> 3 swap(string a,string b)

All of them methods you'll never see in Java, as Java always passes by value.

> where swap func swaps the value of a ,b in all 3

> cases

> u know that ur login for all the 3 cases is same but

The login?

> the parameters passed will be of different type(int

> ,float,string)

> instead of using overloaded func and doing the

> reword

> u can use generic template will will handle all of

> the data at runtime

What are you talking about?

CeciNEstPasUnProgrammeura at 2007-7-14 21:25:30 > top of Java-index,Java Essentials,Java Programming...
# 3

> What is the use of Assertions,Collections,Generics in

> java?

> I have gone through the SUN material also regarding

> these topics but it is yet not clear for me.

> Please help me.

What material did you go through, and what didn't you understand?

CeciNEstPasUnProgrammeura at 2007-7-14 21:25:31 > top of Java-index,Java Essentials,Java Programming...