You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: