Skip to content

Fix the use of generics in the Flatten Array exercise #2896

@kahgoh

Description

@kahgoh

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<?>.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions