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

PYP Q 2d #593

Open
danyelys opened this issue Apr 27, 2022 · 2 comments
Open

PYP Q 2d #593

danyelys opened this issue Apr 27, 2022 · 2 comments

Comments

@danyelys
Copy link

Screenshot (161)

Hi anyone knows why this works for list but not arrays and how i can implement it to work for an array. Im guessing Arrays.stream returns a stream of strictly type int so map has to be int to int? Not sure how to implement it otherwise.

@alantay11
Copy link

I think it'll work if you add .boxed() before mapping

@chowys
Copy link

chowys commented Apr 27, 2022

I believe the issue might be with your arr being an array of int (primitive type) rather than Integer. As the above comment mentioned, boxed() might work by boxing each element (i.e are of type int) to Integer, returning Stream of Integers. For list, as seen in your code, you are taking in List of Integers so naturally that should work. This is what I understand, do correct me if I am wrong tho.

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

3 participants