-
Notifications
You must be signed in to change notification settings - Fork 2
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
1819SEM1 Question 3 #397
Comments
Once you process the stream it is gone. Ie if you find the max you cannot use the stream again to find the minimum. I suggest converting every element of the IntStream to an instance of the minMax class. Inside your lambda you should extract the min of x and the min of y and compare them and get the minimum between the 2. |
Hi you can only operate on the stream once. Meaning to say instream can only be used once, so after calling a terminal operation on a stream (max() in this case), you cannot use the same stream again. You can check out this link for a clearer explanation. |
Streams can only be used once, once consumed if cannot be reused. |
As what is already mentioned above, the stream has been operated on and to solve this question, you can try using reduce instead. |
Summary
I have trouble using the stream method. I can't figure out why. Can anyone help me? :))
Description
Post the question that you would like your peers or seniors to answer.
Suggested Answer (if any):
Screenshots (if any):
The text was updated successfully, but these errors were encountered: