We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@test public void simpleTest(){ List numbers = Arrays.asList(1, 2, 3); int[] factor = new int[] { 2 }; Stream stream = numbers.stream() .map(e -> e * factor[0]); factor[0] = 0; stream.forEach(System.out::println); } 作者大大,请问这个为什么改了factor[0]的数值,遍历出来的流数值就会改变呢? 明明map映射的时候,采用的是factor[0]=2的数值啊。无法理解,能解释一下吗?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
@test
public void simpleTest(){
List numbers = Arrays.asList(1, 2, 3);
int[] factor = new int[] { 2 };
Stream stream = numbers.stream()
.map(e -> e * factor[0]);
factor[0] = 0;
stream.forEach(System.out::println);
}
作者大大,请问这个为什么改了factor[0]的数值,遍历出来的流数值就会改变呢? 明明map映射的时候,采用的是factor[0]=2的数值啊。无法理解,能解释一下吗?
The text was updated successfully, but these errors were encountered: