The exercises uses <T> List<T> flatten(List<T> list)
. The problem with this is that T
can only be an Object
type because the tests provides a List
of different type of objects. For example, testFiveLevelsOfNestingWithNoNulls
gives a list with an int
, a char
and a List
. Because they are different types of objects, T
can only be an Object
.
I propose that method's the return and parameter be updated to be either a List<Object>
or List<?>
.