Sure, here’s the translation: 我们能否使用并行流来替代 Java 的线程?

huangapple go评论71阅读模式
英文:

Can we replace java Thread using parallel stream?

问题

可以用并行流(parallel stream)来替代 Java 的线程(Thread)吗?既然我们可以使用流在并行中执行多个操作,那么为什么还需要线程池呢?

英文:

Can we replace java Thread using parallel stream? As we can perform multiple operation in parallel using stream then why we need thread pools?

答案1

得分: 4

你的意思是是否每个线程使用都可以被并行流替代?

  1. 线程池在并行流之前就存在了。
  2. 并不是每个异步问题都可以通过并行流来解决。
英文:

Do you mean whether every thread use can be replaces by parallel streams?

  1. Threadpools existed long before parallel stream.
  2. Not every asynchronous problem can be solved by parallel streams.

huangapple
  • 本文由 发表于 2020年8月15日 21:21:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/63426496.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定