Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRicardo Sala
16,212 PointsUnderstanding Generics
Hey guys! As always, thank you in advance for your help!
I am triying to understand exactly what generics are used for.
As I understood, is just to avoid having other types of objects being the parameter of a method that is not ready to handle them, right?
Apart from that, is there anything else? Am I missing something here? (I think I am!)
A couple of simple examples would really help here :)
1 Answer
sankalp yadav
2,101 PointsJust undergo this for 15 minutes only http://www.geeksforgeeks.org/generics-in-java/
thank me later.
Wolfgang Warneke
10,845 PointsWolfgang Warneke
10,845 PointsThis YouTube video helped me understand it a little better myself
EDIT: for thinking of <> as 'of' then in this example Glass<Juice> & Glass<Water> would be 'glass of juice' and 'glass of water' respectively