3 ms·
You describe how it works, but not what it means in simple terms. List<Shape> is not a "list of Shapes", it's a "list parametrized with Shape" List<? extends
by guard-of-terra 15y ago
You describe how it works, but not what it means in simple terms.
List<Shape> is not a "list of Shapes", it's a "list parametrized with Shape"
List<? extends Shape> is a "list parametrized with something that extends Shape"
e.g. you can assign it with List<Circle> (you can't assign it to List<Shape> since Shape != Circle)
and then you can do operations on it that would not break List<Circle> (can't put Square in it)
- myspy 15y agoGreat, thank you. It's interesting to learn, when you don't know how to describe something in simple terms. I blame my lacking college professor and me, not taking enough time to learn it properly.