what are generics classes and methods and ehat is collection api in java?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what are generics classes and methods and ehat is collection api in java??

is collection api and generics are same in java?? help required

10th Feb 2020, 5:31 PM
Wasiq Abdullah
3 Answers
+ 2
Collection API was introduced to handle data structures in an easy way and made things pretty simple so that you can focus more on the actual logic behind the code and not on how to store it. On the other hand generics are something similar to templates in C++ which helps in code reusability and reduces redundancy. List, Set, Map are all generic because you can declare the type of data which you want to store.
10th Feb 2020, 5:45 PM
Avinesh
Avinesh - avatar
0
Avinesh right bro...but can you plz explain generics with help of code?
10th Feb 2020, 5:47 PM
Wasiq Abdullah