Skip to content

Commit e624a68

Browse files
committed
docs: parallelStream hyperlink add
1 parent ba55162 commit e624a68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

exercises/practice/parallel-letter-frequency/.approaches/introduction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ A [`map`][map], being a key-value pair structure, is suitable for recording freq
1010
If the data being counted has a limited range (e.g., `Characters` or `Integers`), an `int[] array` or [`List<Integer>`][list] can be used to record frequencies.
1111

1212
Parallel processing typically takes place in a multi-[`thread`][thread] environment.
13-
The Java 8 [`stream`][stream] API provides methods that make parallel processing easier, including the `parallelStream()` method.
14-
With `parallelStream()`, developers can use the [`ForkJoinPool`][ForkJoinPool] model for workload division and parallel execution, without the need to manually manage threads or create custom thread pools.
13+
The Java 8 [`stream`][stream] API provides methods that make parallel processing easier, including the [`parallelStream()`][stream] method.
14+
With [`parallelStream()`][stream], developers can use the [`ForkJoinPool`][ForkJoinPool] model for workload division and parallel execution, without the need to manually manage threads or create custom thread pools.
1515

1616
The [`ForkJoinPool`][ForkJoinPool] class, optimized for dividing and managing tasks, makes parallel processing efficient.
17-
However, `parallelStream()` uses the common [`ForkJoinPool`][ForkJoinPool] by default, meaning multiple `parallelStream` instances share the same thread pool unless configured otherwise.
17+
However, [`parallelStream()`][stream] uses the common [`ForkJoinPool`][ForkJoinPool] by default, meaning multiple [`parallelStream`][stream] instances share the same thread pool unless configured otherwise.
1818

1919
As a result, parallel streams may interfere with each other when sharing this thread pool, potentially affecting performance.
2020
Although this doesn’t directly impact solving the Parallel Letter Frequency problem, it may introduce issues when thread pool sharing causes conflicts in other applications.
@@ -130,7 +130,7 @@ For more information, check the [`fork/join` approach][approach-fork-join].
130130

131131
## Which approach to use?
132132

133-
When tasks are simple or do not require a dedicated thread pool (such as in this case), the `parallelStream` approach is recommended.
133+
When tasks are simple or do not require a dedicated thread pool (such as in this case), the [`parallelStream`][stream] approach is recommended.
134134
However, if the work is complex or there is a need to isolate thread pools from other concurrent tasks, the [`ForkJoinPool`][ForkJoinPool] approach is preferable.
135135

136136
[thread]: https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html

0 commit comments

Comments
 (0)