Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kahgoh opened this issue Jan 3, 2025 · 2 comments
Open

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

kahgoh opened this issue Jan 3, 2025 · 2 comments
Assignees

Comments

@kahgoh
Copy link
Member

kahgoh commented Jan 3, 2025

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

@kahgoh kahgoh self-assigned this Jan 3, 2025
@jagdish-15
Copy link
Contributor

I'll get right onto it!

@jagdish-15
Copy link
Contributor

A PR has been raised to address this issue: PR #2900. It updates the method signature in the starter code and ensures the example solution is consistent with the updated signature. Please review it at your convenience.

@kahgoh kahgoh changed the title Fix the use generics in the Flatten Array exercise Fix the use of generics in the Flatten Array exercise Jan 4, 2025
@kahgoh kahgoh removed their assignment Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants