CodeGym /Courses /Java Collections /Tasks | Level 5 | Lesson 6

Tasks | Level 5 | Lesson 6

Java Collections
Level 5 , Lesson 6
Available
8
Task
Java Collections, level 5, lesson 6
Locked
Several superclasses for generics
You're given a Solution class with a T type parameter. Place bounds on the T type parameter. T must simultaneously inherit the ClassForGenerics class and implement InterfaceForGenerics interface. You can only change the Solution class.
8
Task
Java Collections, level 5, lesson 6
Locked
Simple generics
Parameterize the Solution class so that it can work with all classes that inherit HashMap. The getMap method must return an object of the map field's type.
16
Task
Java Collections, level 5, lesson 6
Locked
Collections & Generics
Implement helper methods in the Solution class that create an appropriate collection and add the passed objects to it. The newArrayList and newHashSet methods have the T type parameter. The newHashMap method has K (key) and V (value) type parameters.
Comments (3)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Justin Smith Level 41, Greenfield, USA, United States
23 November 2022
If, like me, you struggle endlessly with generics, here's a helpful video that covers pretty much all of the concepts you'll face in the above tasks. https://www.youtube.com/watch?v=K1iu1kXkVoA
matemate123 Level 50, Kraków, Poland
11 October 2023
It's really helpful film. Gave help to first task.
Andrei Level 41
14 July 2021
Great exercises!